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
fe76f178ee3453f9cce4f272e40f9e7e
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int N; static long x; static int[] d = new int[200002]; static long[] S = new long[200002]; static long[] H = new long[200002]; static long Answer; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedRead...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
0ff7828c671315d235515af6d282332d
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int N; static long x; static int[] d = new int[200002]; static long[] S = new long[200002]; static long[] H = new long[200002]; static long Answer; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedRead...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
4632a0c6868cbda773d157d3ccb907d8
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.*; import java.math.* ; public class Main { InputStream is; PrintWriter out; String INPUT = ""; //class Declaration static class pair implements Comparable<pai...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
6f329b5eb45b8ca5c92335a8e4049d34
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; public class Main { private static final int MAXN = 5000; private static final...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
ffa059b6d062b2d5e94b85bfd4b762f7
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.net.Inet4Address; import java.util.*; import java.lang.*; import java.util.HashMap; import java.util.PriorityQueue; public class Solution implements Runnable { static class pair implements Comparable { int f; ...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
83d247f65ccdd38a37e356c4988b5624
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.*; import java.text.*; import java.util.*; import java.math.*; public class template { public static void main(String[] args) throws Exception { new template().run(); } public void run() throws Exception { FastScanner f = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int n ...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
18454789b25a3f4a9d7c305ad3b68d57
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
//package javaapplication5; import java.io.*; import java.util.*; public class utkarsh { BufferedReader br; PrintWriter out; long mod = (long) (1e9 + 7), inf = (long) (3e18); long sigma(long n) { return n * (n + 1) / 2; } void solve() { int n = ni(); long...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
f4ce4826c95d7a61eb94713bc504dafa
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
// Spaghetti code import java.io.*; import java.math.*; import java.util.*; public class Main { static int mod=(int)(1e9+7); static int mod2=998244353; static PrintWriter pw; static class FastReader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
66fcbd079a92ff9db8b3f3b1410ee279
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class Solution { static class Pair<A,B> { A parent; B rank; Pair(A parent,B rank) { this.rank=rank; this.parent=parent; } } static class Node{ int x; ...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
30f2e4141ed950e365a8a2055363f007
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class Solution { static class Pair<A,B> { A parent; B rank; Pair(A parent,B rank) { this.rank=rank; this.parent=parent; } } static class Node{ int x; ...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
dc0e15da076298f3b83597ad342125da
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.util.*; public class Main { final static int maxn=(int)1e6+10; final static int mod=(int)2e5+10; static long num[]=new long [maxn]; static int d[]=new int [maxn]; static long sum[]=new long [maxn]; static long sumday[]=new long [maxn]; public static void main(String args[]) { Scanner input=new Sc...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
0c581845e9b1e5d128d96247ef2f31ee
train_000.jsonl
1590503700
You've been in love with Coronavirus-chan for a long time, but you didn't know where she lived until now. And just now you found out that she lives in a faraway place called Naha. You immediately decided to take a vacation and visit Coronavirus-chan. Your vacation lasts exactly $$$x$$$ days and that's the exact number ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.stream.IntStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.f...
Java
["3 2\n1 3 1", "3 6\n3 3 3", "5 6\n4 2 3 1 3"]
2 seconds
["5", "12", "15"]
NoteIn the first test case, the numbers of the days in a year are (indices of days in a corresponding month) $$$\{1,1,2,3,1\}$$$. Coronavirus-chan will hug you the most if you come on the third day of the year: $$$2+3=5$$$ hugs.In the second test case, the numbers of the days are $$$\{1,2,3,1,2,3,1,2,3\}$$$. You will g...
Java 8
standard input
[ "greedy", "two pointers", "implementation", "binary search", "brute force" ]
9ba374e20305d93ba42ef152e2cad5b5
The first line of input contains two integers $$$n$$$ and $$$x$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of months in the year and the number of days you can spend with your friend. The second line contains $$$n$$$ integers $$$d_1, d_2, \ldots, d_n$$$, $$$d_i$$$ is the number of days in the $$$i$$$-th month ($$$...
1,900
Print one integer — the maximum number of hugs that you can get from Coronavirus-chan during the best vacation in your life.
standard output
PASSED
30169bdab021fc839637e05b9029b2b2
train_000.jsonl
1308582000
A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions aren't connected in any way.In the constructing process m bidirectional ski roa...
256 megabytes
//package e75; import java.util.*; import java.io.*; public class Main { BufferedReader in; StringTokenizer str = null; private int nextInt() throws Exception{ if (str == null || !str.hasMoreElements()) str = new StringTokenizer(in.readLine()); return Integer.parseInt(str.nextToken()); } private int f...
Java
["3 4\n1 3\n2 3\n1 2\n1 2"]
2 seconds
["0\n0\n1\n3"]
NoteLet us have 3 junctions and 4 roads between the junctions have already been built (as after building all the roads in the sample): 1 and 3, 2 and 3, 2 roads between junctions 1 and 2. The land lot for the construction will look like this: The land lot for the construction will look in the following way: We can ...
Java 6
standard input
[ "data structures", "dsu", "graphs" ]
f80dc7b12479551b857408f4c29c276b
The first line contains two integers n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ 105). They represent the number of junctions and the number of roads correspondingly. Then on m lines follows the description of the roads in the order in which they were built. Each road is described by a pair of integers ai and bi (1 ≤ ai, bi ≤ n, ai ...
2,300
Print m lines: the i-th line should represent the number of ways to build a ski base after the end of construction of the road number i. The numbers should be printed modulo 1000000009 (109 + 9).
standard output
PASSED
e874a94b795c07e0f88e6c6fe61d80ca
train_000.jsonl
1308582000
A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions aren't connected in any way.In the constructing process m bidirectional ski roa...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class SkiBase { private static class UnionSet { private int[] parent; private UnionSet(int size){ parent = new int[size]; for(int i = 0; i < size; i++){ parent[i] = i; } } private int g...
Java
["3 4\n1 3\n2 3\n1 2\n1 2"]
2 seconds
["0\n0\n1\n3"]
NoteLet us have 3 junctions and 4 roads between the junctions have already been built (as after building all the roads in the sample): 1 and 3, 2 and 3, 2 roads between junctions 1 and 2. The land lot for the construction will look like this: The land lot for the construction will look in the following way: We can ...
Java 6
standard input
[ "data structures", "dsu", "graphs" ]
f80dc7b12479551b857408f4c29c276b
The first line contains two integers n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ 105). They represent the number of junctions and the number of roads correspondingly. Then on m lines follows the description of the roads in the order in which they were built. Each road is described by a pair of integers ai and bi (1 ≤ ai, bi ≤ n, ai ...
2,300
Print m lines: the i-th line should represent the number of ways to build a ski base after the end of construction of the road number i. The numbers should be printed modulo 1000000009 (109 + 9).
standard output
PASSED
5628a692ca6ff9938f4ef87d0bdd4b60
train_000.jsonl
1308582000
A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions aren't connected in any way.In the constructing process m bidirectional ski roa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Main { /** * @param args */ static int N, M; static int[] p; static long[] c; static long mod = 1000000009; publ...
Java
["3 4\n1 3\n2 3\n1 2\n1 2"]
2 seconds
["0\n0\n1\n3"]
NoteLet us have 3 junctions and 4 roads between the junctions have already been built (as after building all the roads in the sample): 1 and 3, 2 and 3, 2 roads between junctions 1 and 2. The land lot for the construction will look like this: The land lot for the construction will look in the following way: We can ...
Java 6
standard input
[ "data structures", "dsu", "graphs" ]
f80dc7b12479551b857408f4c29c276b
The first line contains two integers n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ 105). They represent the number of junctions and the number of roads correspondingly. Then on m lines follows the description of the roads in the order in which they were built. Each road is described by a pair of integers ai and bi (1 ≤ ai, bi ≤ n, ai ...
2,300
Print m lines: the i-th line should represent the number of ways to build a ski base after the end of construction of the road number i. The numbers should be printed modulo 1000000009 (109 + 9).
standard output
PASSED
d0debac0a60b9baf18daa1428faa5150
train_000.jsonl
1308582000
A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions aren't connected in any way.In the constructing process m bidirectional ski roa...
256 megabytes
import java.io.*; import java.util.*; public class E implements Runnable{ BufferedReader in; StringTokenizer token = null; public int nextInt(){ try{ while (token==null || !token.hasMoreElements()) token = new StringTokenizer(in.readLine()); return Integer.parseInt(token.nextToken()); } catch (Exce...
Java
["3 4\n1 3\n2 3\n1 2\n1 2"]
2 seconds
["0\n0\n1\n3"]
NoteLet us have 3 junctions and 4 roads between the junctions have already been built (as after building all the roads in the sample): 1 and 3, 2 and 3, 2 roads between junctions 1 and 2. The land lot for the construction will look like this: The land lot for the construction will look in the following way: We can ...
Java 6
standard input
[ "data structures", "dsu", "graphs" ]
f80dc7b12479551b857408f4c29c276b
The first line contains two integers n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ 105). They represent the number of junctions and the number of roads correspondingly. Then on m lines follows the description of the roads in the order in which they were built. Each road is described by a pair of integers ai and bi (1 ≤ ai, bi ≤ n, ai ...
2,300
Print m lines: the i-th line should represent the number of ways to build a ski base after the end of construction of the road number i. The numbers should be printed modulo 1000000009 (109 + 9).
standard output
PASSED
c242cc07ef4c02dfa62ed34a614a266e
train_000.jsonl
1308582000
A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions aren't connected in any way.In the constructing process m bidirectional ski roa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class E { static int[] P; static int[] rank; static int[] cycles; public static void create(int x) { P[x] = x; rank[x] = 0; } public static void merge(int x, int y) { ...
Java
["3 4\n1 3\n2 3\n1 2\n1 2"]
2 seconds
["0\n0\n1\n3"]
NoteLet us have 3 junctions and 4 roads between the junctions have already been built (as after building all the roads in the sample): 1 and 3, 2 and 3, 2 roads between junctions 1 and 2. The land lot for the construction will look like this: The land lot for the construction will look in the following way: We can ...
Java 6
standard input
[ "data structures", "dsu", "graphs" ]
f80dc7b12479551b857408f4c29c276b
The first line contains two integers n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ 105). They represent the number of junctions and the number of roads correspondingly. Then on m lines follows the description of the roads in the order in which they were built. Each road is described by a pair of integers ai and bi (1 ≤ ai, bi ≤ n, ai ...
2,300
Print m lines: the i-th line should represent the number of ways to build a ski base after the end of construction of the road number i. The numbers should be printed modulo 1000000009 (109 + 9).
standard output
PASSED
c0e8c9d52b228025228aeb0b0de584b3
train_000.jsonl
1308582000
A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions aren't connected in any way.In the constructing process m bidirectional ski roa...
256 megabytes
import static java.lang.Math.*; import java.util.*; import java.io.*; public class E { boolean showDebug = true; class DisjointSet { int[] parent, rank; public DisjointSet(int size) { parent = new int[size]; rank = new int[size]; for (int i=0; ...
Java
["3 4\n1 3\n2 3\n1 2\n1 2"]
2 seconds
["0\n0\n1\n3"]
NoteLet us have 3 junctions and 4 roads between the junctions have already been built (as after building all the roads in the sample): 1 and 3, 2 and 3, 2 roads between junctions 1 and 2. The land lot for the construction will look like this: The land lot for the construction will look in the following way: We can ...
Java 6
standard input
[ "data structures", "dsu", "graphs" ]
f80dc7b12479551b857408f4c29c276b
The first line contains two integers n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ 105). They represent the number of junctions and the number of roads correspondingly. Then on m lines follows the description of the roads in the order in which they were built. Each road is described by a pair of integers ai and bi (1 ≤ ai, bi ≤ n, ai ...
2,300
Print m lines: the i-th line should represent the number of ways to build a ski base after the end of construction of the road number i. The numbers should be printed modulo 1000000009 (109 + 9).
standard output
PASSED
42696321359ccd9f2bb4d072423ed1f8
train_000.jsonl
1308582000
A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions aren't connected in any way.In the constructing process m bidirectional ski roa...
256 megabytes
import static java.lang.Math.*; import java.util.*; import java.io.*; public class E { boolean showDebug = true; class DisjointSet { int[] parent, rank; public DisjointSet(int size) { parent = new int[size]; rank = new int[size]; for (int i=0; ...
Java
["3 4\n1 3\n2 3\n1 2\n1 2"]
2 seconds
["0\n0\n1\n3"]
NoteLet us have 3 junctions and 4 roads between the junctions have already been built (as after building all the roads in the sample): 1 and 3, 2 and 3, 2 roads between junctions 1 and 2. The land lot for the construction will look like this: The land lot for the construction will look in the following way: We can ...
Java 6
standard input
[ "data structures", "dsu", "graphs" ]
f80dc7b12479551b857408f4c29c276b
The first line contains two integers n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ 105). They represent the number of junctions and the number of roads correspondingly. Then on m lines follows the description of the roads in the order in which they were built. Each road is described by a pair of integers ai and bi (1 ≤ ai, bi ≤ n, ai ...
2,300
Print m lines: the i-th line should represent the number of ways to build a ski base after the end of construction of the road number i. The numbers should be printed modulo 1000000009 (109 + 9).
standard output
PASSED
779f32b0c38c9836fca26494605ef9e4
train_000.jsonl
1308582000
A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions aren't connected in any way.In the constructing process m bidirectional ski roa...
256 megabytes
import static java.lang.Math.*; import java.util.*; import java.io.*; public class E { boolean showDebug = true; class DisjointSet { int[] parent, rank; public DisjointSet(int size) { parent = new int[size]; rank = new int[size]; for (int i=0; ...
Java
["3 4\n1 3\n2 3\n1 2\n1 2"]
2 seconds
["0\n0\n1\n3"]
NoteLet us have 3 junctions and 4 roads between the junctions have already been built (as after building all the roads in the sample): 1 and 3, 2 and 3, 2 roads between junctions 1 and 2. The land lot for the construction will look like this: The land lot for the construction will look in the following way: We can ...
Java 6
standard input
[ "data structures", "dsu", "graphs" ]
f80dc7b12479551b857408f4c29c276b
The first line contains two integers n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ 105). They represent the number of junctions and the number of roads correspondingly. Then on m lines follows the description of the roads in the order in which they were built. Each road is described by a pair of integers ai and bi (1 ≤ ai, bi ≤ n, ai ...
2,300
Print m lines: the i-th line should represent the number of ways to build a ski base after the end of construction of the road number i. The numbers should be printed modulo 1000000009 (109 + 9).
standard output
PASSED
ef54c781e3ea6098dbeafa9bbea79774
train_000.jsonl
1308582000
A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains n ski junctions, numbered from 1 to n. Initially the junctions aren't connected in any way.In the constructing process m bidirectional ski roa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * Author - * User: kansal * Date: 6/16/11 * Time: 8:26 PM */ public class E { public static void main(String[] args) { reader = new BufferedReader(new InputStreamReader(Sy...
Java
["3 4\n1 3\n2 3\n1 2\n1 2"]
2 seconds
["0\n0\n1\n3"]
NoteLet us have 3 junctions and 4 roads between the junctions have already been built (as after building all the roads in the sample): 1 and 3, 2 and 3, 2 roads between junctions 1 and 2. The land lot for the construction will look like this: The land lot for the construction will look in the following way: We can ...
Java 6
standard input
[ "data structures", "dsu", "graphs" ]
f80dc7b12479551b857408f4c29c276b
The first line contains two integers n and m (2 ≤ n ≤ 105, 1 ≤ m ≤ 105). They represent the number of junctions and the number of roads correspondingly. Then on m lines follows the description of the roads in the order in which they were built. Each road is described by a pair of integers ai and bi (1 ≤ ai, bi ≤ n, ai ...
2,300
Print m lines: the i-th line should represent the number of ways to build a ski base after the end of construction of the road number i. The numbers should be printed modulo 1000000009 (109 + 9).
standard output
PASSED
65c7dec889d2d61ee2effbb31953c4cd
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class E { public StringBuilder interleave(int n, char first, char second) throws Exception { StringBuilder sb = new StringBuilder(""); for(int i = 0; i < n; i++) { sb.append(first); sb.append(second); } return sb; } public String...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
fdc25c6c4726bc19753fcf03e835f861
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.*; public class Codeforces { static boolean isp[] = new boolean[1000001]; public static void main(String[] args) throws IOException{ Scanner s = new Scanner(System.in); StringBuffer sb = new StringBuffer(); int n = s.nextInt(); String a = s.next(); String b = s.next();...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
9633f8ce23fea0e743c6c3bd89b9583d
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Solver { public static void main(String[] args) throws IOException { new Solver().read(); } static Scanner in = new Scanner(System.in); st...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
cade708d84fb485ebb0420ddade4513b
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import javax.print.attribute.standard.PrinterMessageFromOperator; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) throws Exception { new Main().run();} // int[] h,ne,to,wt; // int ct = 0; // ...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
b13c2373ae6722175771e483595460af
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { new Thread(null, new Runnable() { public void run() { solve(); ...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
57199266c0f76cd98263d5d725de8192
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.util.*; import java.io.*; import java.text.*; public class E { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); String x = sc.next(); String y = sc.next(); HashSet<String> abc = ...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
ae9d0ce9ed3888f1ad8fba6ddef71dfb
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class E { static class InputReader { BufferedReader reader; StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); token...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
d8941d2fa372bfe76c065ed3bf95e4ec
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); PrintWriter out = new PrintWriter(Sy...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
91ee07811bae5b6458cb66cec41e29fd
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
/** * Created at 03:18 on 2019-08-31 */ import java.io.*; import java.util.*; public class Main { static FastScanner sc = new FastScanner(); static Output out = new Output(System.out); static final int[] dx = {0, 1, 0, -1}; static final int[] dy = {-1, 0, 1, 0}; static final long MOD = (long) (1e9 + 7)...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
c583035e3ff7420b6def00eebb89f115
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import j...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
6a35db5da2cfefbbe351ebe890c6d8ec
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Iterator; import java.util.Tr...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
1cc78e60e4af272ae63b6f2c8133daef
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.io.OutputStream; import java.io.BufferedWriter; import java.util.HashSet; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.InputStream; /** * Built using CHelper plug-in...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
7f8687529427798c45bed481456c169c
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; import static java.lang.Math.*; public class cf1 implements Runnable { long gcd(long a, long b) { if (a == 0) return b; return gcd(b % a, a); } long power(long x, long y, long p) { long res = ...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
a54f1cbf2d13c4ce6109deffee36a358
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.*; public class Main { static PrintWriter pw; static int n; static TreeSet<String> tr; public static boolean has(String d) { return tr.contains(d); } public static void doo(char d) { int g[] = new int[3]; for (int i = 0; i < 3; i++) ...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
746eb20103719e2eb92e31461c4b00fe
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.*; public class CF1213E extends PrintWriter { CF1213E() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1213E o = new CF1213E(); o.main(); o.flush(); } char[] cc; int n; void fill1(int a, int b, int c) { for (int i...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
5bc3247a73c152f6f349055b95ad1e93
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.LinkedList; import java.util.PriorityQueue; import java.util.Queue; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt();...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
c06ca477f8d43d5a87d67d878313d96a
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.*; import java.util.function.Consumer; public class MainE { static int N; static String S, T; public static void main(String[] args) { FastScanner sc = new FastScanner(System.in); N = sc.nextInt(); S = sc.next(); T = sc.next(); S...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
1fb8a3a4082cda7272d0af58dbea81bb
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class CF1213E { static boolean nextPermutation(char[] c) { int first = getFirst(c); if(first == -1) return false; int toSwap = c.length - 1; while (c[first] >= c[toSwap]) ...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
82eed43c91425225a49221cbe9f40006
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.InputMismatchException; public class Solution { static String s; static String t; public static void main(String[] args) { InputReader in = new InputReader(System.in); int n = in.nextInt(); s = in.nextLine(); t = in.nextLine(); S...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
9a59fe80c51396c9bbd629a40b99a169
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
a48f7071ca82d569d3d690a3f9dc6117
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class pair{ int cost;int occ; pair(int x,int y){ cost=x;occ=y; } } public static void main(String[] args) throws IOException { MScanner sc=new MScanner(System.in); PrintWriter pw=new PrintWriter(System.out); pw.println("YES"); int n=...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
c41f6117dd06dfef1af5c334e9090d2e
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Optional; import java.util.StringTokenizer; import java.util.Vector; impor...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
1b50cffb314015517c58ece48af0476a
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class E { static class InputReader { BufferedReader reader; StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); token...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
88433ca107fa4efc3e522f092fbdc5f5
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.math.BigInteger; import java.util.*; import java.lang.*; import java.io.*; public class Solution { static char c1,c2,c3,c4; public static boolean check(StringBuilder s) { for(int i=0;i<s.length()-1;i++) { if(s.charAt(i)==c1 && s.charAt(i+1)==c2) retur...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
004c15a258609d8787f0045dec07fc1c
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.StringTokenizer; public class E582TwoSmallStrings { static PrintWriter pr = new PrintWriter(System.out); public static class InputReader { private BufferedReader reader; private StringTokenizer tokenizer; public InputReade...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
a63420eb76b569bc37e48ff0cef21c18
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.*; public class E implements Runnable { FastReader scn; PrintWriter out; String INPUT = ""; void solve() { int n = scn.nextInt(); String s1 = scn.next(), s2 = scn.next(); if(c1(s1) && c1(s2)) { String s = "abc"; out.println("YES"); for(int i = 0; i < n; i++) { ...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
76590fe29a772c0727a5c0d2a3895c4e
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
// package Quarantine; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; public class SmallStrings { public static void main(String[] args)throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); ...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
5ea0678e603381132b9f8bdd52908844
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CH...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
7cdcebc2f4a9ff6eea286277420c8f9f
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
//package cf582d3; import java.io.*; import java.util.*; public class E { static char[] s, t; public static void main(String[] args) { MyScanner sc = new MyScanner(); int n = sc.nextInt(); s = sc.nextLine().toCharArray(); t = sc.nextLine().toCharArray(); out.println("YES"); if(s[0] == s[1] && t[0] == t[1...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
a77db49ce4c3cb4aa95652984815644e
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n=Integer.parseInt(in.nextLine()); String s=in.nextLine(),t=in.nextLine(); if(s.equals("aa")||s.equals("bb")||s.equals("cc")) { if(t.equals("aa")||...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
963fd62c2bf8b8a4bda2d50eeee70ff6
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.IOException; import java.io.Reader; import java.io.InputStreamReader; import java.util.StringTokenizer; imp...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
d694bde8fd655295d7bdd090a999e66b
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class CF { public static boolean validTriplet(char positions[], HashSet<String>set){ int arrayLen = positions.length; for(int i = 0;i < arrayLen;i++){ String currentString = positions[i] + "" + p...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
19a8ffe491cd0692d5a86a06f1e2f6ca
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import sun.util.resources.cldr.ar.CalendarData_ar_YE; import java.io.*; import java.util.*; public class l { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
40eebcaad29e4c9dea6c9d711ac65dad
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.TreeMap; public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedRe...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
70cb88b2444c2e6015f6a0c4d158aa77
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.*; public class E { PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tok; public void go() throws IOException { ntok(); ...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
831dc5f8ed36c9639e6beac656ec48ec
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
/** * BaZ :D */ import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static MyScanner scan; static PrintWriter pw; static long MOD = 1_000_000_007; static long INF = 1_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main(Stri...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
8898dbf05a8362ba34ff69fb27077b6f
train_000.jsonl
1567175700
You are given two strings $$$s$$$ and $$$t$$$ both of length $$$2$$$ and both consisting only of characters 'a', 'b' and 'c'.Possible examples of strings $$$s$$$ and $$$t$$$: "ab", "ca", "bb".You have to find a string $$$res$$$ consisting of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters shou...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int inf = (int) (1e9 + 7); static char a[], b[]; static boolean check(char res[]) { for(int i = 0;i < res.length - 1;i++) { if (res[i] == a[0] && res[i + 1] == a[1]) return false; if (res[i] == b[0] && res[i ...
Java
["2\nab\nbc", "3\naa\nbc", "1\ncb\nac"]
2 seconds
["YES\nacbbac", "YES\ncacbacbab", "YES\nabc"]
null
Java 8
standard input
[ "constructive algorithms", "brute force" ]
7f45fba2c06fe176a2b634e8988076c2
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of characters 'a', 'b' and 'c' in the resulting string. The second line of the input contains one string $$$s$$$ of length $$$2$$$ consisting of characters 'a', 'b' and 'c'. The third line of the input contains one string $$$...
1,900
If it is impossible to find the suitable string, print "NO" on the first line. Otherwise print "YES" on the first line and string $$$res$$$ on the second line. $$$res$$$ should consist of $$$3n$$$ characters, $$$n$$$ characters should be 'a', $$$n$$$ characters should be 'b' and $$$n$$$ characters should be 'c' and $$...
standard output
PASSED
a39629d614cd1f20997dd32d6439999d
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.util.*; import java.io.*; public class cubessorting { static class FastScanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); String next() { while (!st.hasMoreTokens()) { t...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
8c2cb664e63a08fa089117965546bd74
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.lang.reflect.Array; import java.util.*; public class inser { public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t = 0; t < T; t++) { int n = in.nextInt(); Integer a[] = new Integer[n]; f...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
1d675ed40f93350e282266db96f035bb
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static int mod = 1000000007; public static void solve(InputReader in, OutputWriter out) { int n = in.readInt(); int a[] = new int[n]; for(int i = 0; i<n; i++){ a[i] = in.readInt(); } boolean can = false; fo...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
11e9598a82e214489346f6cd370de8fa
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.util.Scanner; public class p1420A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); l: for (int t = sc.nextInt(); t-- > 0;) { int n = sc.nextInt(), a[] = new int[n]; for (int i = 0; i < n; i++) a[i] = sc.nextInt(); for (int i = 0; i < n - 1; i++) if (a[i] <=...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
6165cace8826b9d73c0f38d0f347cc9a
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.util.Scanner; public class p1420A { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { l: for (int t = sc.nextInt(); t-- > 0;) { int n = sc.nextInt(), a[] = readArray(n); for (int i = 0; i < n - 1; i++) if (a[i] <= a[i + 1]) { System.out.println("YES");...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
ae523916f17c7f0138a811dd1a327682
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
public class TaskA { public static void main(String []args){ java.util.Scanner scan = new java.util.Scanner(System.in); int t = scan.nextInt(); for(int i = 0; i < t; i++) { int N = scan.nextInt(); int[] a = new int[N]; for(int j = 0; j < N; j...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
a5b43ab364466e41c4787e56b9f5d27d
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int test = scanner.nextInt(); while(test-->0){ int cubes = scanner.nextInt(); ArrayList<Integer> cubeVolum...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
4133e1310e60a582c356783d8b5ba90d
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
// package Round672; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class typeA { static long merge2(long[] A,int s, int mid, int n) { int i=s,j=mid,k=0; long[] temp = new long[n-s+1]; long count=0; while(i<mid && j<=n)...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
73031d0d0d2c3c99f31cd047008fefee
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class Main{ public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(br.rea...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
cf04ec47505f9d59881b5e6ef51ce045
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.*; public class A { public static void main (String[] args) throws java.lang.Exception { InputReader in = new InputReader(System.in); int t = in.readInt(); while(t-->0) { int n =in.readInt(); int[]nums = new int[n]...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
03eb0053d7d34f46d175d0cc3bababd0
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ static PrintWriter out = new PrintWriter(System.out); public static void main (String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] input = br.readLine().trim().split(" "); int n...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
fbcdfd2ce237f2488a8631c2249bd5f5
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class code4{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() ...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
394f9d55c75af795659a3e918c995282
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.util.*; import java.util.regex.Pattern; public class CubesSorting { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); // int count = 0; for (int i=0; i<n; i++) { // Test cases boolean yes = false; int x = in.nextInt(); // number in case // i...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
235d951e3e6a6ba9473fd322fff3d14d
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; /** * Always */ public class Always { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(rea...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
8cc3041c28cf06482c1e390a8fb10af2
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
//Written by Shagoto import java.util.*; import java.io.*; public class Main { // -------- Generating Prime Numbers Using Bit-wise sieve -------- // static HashSet<Integer> primes = new HashSet<Integer>(); // static BitSet bs = new BitSet(10000001); // static void sieve() // { // primes.add(2); // for(int i =...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
b09c98c7a7563eeddd5a0856b872cea5
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.util.*; public class CodeForces1420A{ public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); for(int i = 0;i<t;i++){ int n = input.nextInt(); int[] a = new int[n]; int c = 0; for(int j = 0;j<n;j++){ a[j] = input.nextInt(); } fo...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
ced60e9bc24383b11769c8dc211e247a
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args){ MyScanner sc = new MyScanner(); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); lo...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
09608cd65b9934df8ab97fe7a745afd0
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
// package com.company; import java.io.*; import java.math.BigInteger; import java.util.*; public class Main <E> { public static void main(String[] args) { Main main = new Main(); main.solve(); } public void solve() { Scanner in = null; PrintWriter out = null; tr...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
8a20d3643b6bb3ec3be56e0d053c1ab6
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; public class Solution{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new ...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
623d9ef1c5afaa6dfccfa62202a0c464
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.util.*; public class Cubesorting { public static void main(String [] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); long a[] = new long[n]; for(int i=0;i<n;i++) { a[i]=sc.nextLong(); } boolean y = false; for(i...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
44968908e12894f3f6c1146261be4807
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.util.*; public class Cubesorting { public static void main(String [] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); long a[] = new long[n]; for(int i=0;i<n;i++) { a[i]=sc.nextLong(); } boolean y = false; for(i...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
ca716cb00d604e69f5e1720ca783d661
train_000.jsonl
1600958100
For god's sake, you're boxes with legs! It is literally your only purpose! Walking onto buttons! How can you not do the one thing you were designed for?Oh, that's funny, is it? Oh it's funny? Because we've been at this for twelve hours and you haven't solved it either, so I don't know why you're laughing. You've got ...
256 megabytes
import java.util.Scanner; public class cubeSorting { public static void main(String[] args) { Scanner obj = new Scanner(System.in); int t = obj.nextInt(); for (int i = 0; i < t; i++) { int n = obj.nextInt(); boolean flag = false; int[] array = new int[n]; for (int j = 0; j < n; j++) { array[j] ...
Java
["3\n5\n5 3 2 1 4\n6\n2 2 2 2 2 2\n2\n2 1"]
1 second
["YES\nYES\nNO"]
NoteIn the first test case it is possible to sort all the cubes in $$$7$$$ exchanges.In the second test case the cubes are already sorted.In the third test case we can make $$$0$$$ exchanges, but the cubes are not sorted yet, so the answer is "NO".
Java 8
standard input
[ "sortings", "math" ]
b34f29e6fb586c22fa1b9e559c5a6c50
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 1000$$$), denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$2 \le n \le 5 \cdot 10^4$$$) — number of cubes. The ...
900
For each test case, print a word in a single line: "YES" (without quotation marks) if the cubes can be sorted and "NO" (without quotation marks) otherwise.
standard output
PASSED
bbafc6049d5bb6ec605436c8cca159f4
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a[]=new int[n]; for (int i = 0; i <n ; i++) { a[i]=sc.nextInt(); }if (n==1){ System.out.println(1); return;} ...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
7264a47219dd22ce0682e9e69688d3b0
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.util.*; public class Elephant { public static void main(String[] args) { Scanner console = new Scanner(System.in); int n = console.nextInt(); int min = console.nextInt(); int numRep = 1; int numCity = 1; int next; for(int i = 2; i <= n; i++) { next = console.nextInt...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
adc80881fc945d2bf17411a600de94e1
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class privet { public static void main(String[] args) throws IOException { BufferedReader bReader = new BufferedReader(new InputStreamReader(System.in)); String kolvo = bReader.readL...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
6571c583222d47c30ae177e4c8b0bc6d
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.StringTokenizer; /* ID: he.andr1 LANG: JAVA TASK: PrA */ public class PrA { public static long time; public static void main(String[] args) throws Exception { time = System.currentTimeMillis(); Bu...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
7388eadfe20005984abc693f73efb8b0
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.StringTokenizer; /* ID: he.andr1 LANG: JAVA TASK: PrA */ public class PrA { public static long time; public static void main(String[] args) throws Exception { time = System.currentTimeMillis(); Bu...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
ff8b65d31241e4f69878c14c91449878
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.awt.Point; 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.Scanner; import java.util.StringTokenizer; public class A { public static vo...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
d070e5f43db06ac37f0b9ae0175ebbfa
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import static java.util.Arrays.deepToString; import java.io.*; import java.util.*; public class A { static void solve() throws Exception { int n = nextInt(); int[] a = new int[n]; for(int i = 0; i < n; i++){ a[i] = nextInt(); } int min = Integer.MAX_VALUE; ...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
6b6b9e8f09b92051b6298cf2b66f1141
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigDecimal; import java.util.Locale; public class A205 { public static void main(String[...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
92557fa3166ef852e94b5645871991e8
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String[] args) throws Exception { new A().solve(); } void solve() throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(in.readLine()); ...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
39e44b2c7a9f5cba05d815937197217f
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.util.*; import java.io.*; public class AContest129{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int times=Integer.parseInt(br.readLine()); String[] in=br.readLine().split(" "); long[]...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
16099556e211910b195bd91c8dd213bf
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.util.*; public class RodzilElephant { public static void main(String[] args) { // Set up scanner Scanner sc = new Scanner(System.in); // System.out.println("Enter how many"); int n = sc.nextInt(); boolean doublemin = false; // System.out.prin...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
5c9329c50570d7f9542c86ecbf3ee4e9
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here ...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
236fd491f7382366a1984031c2e49546
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ //package adream; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Scanner; /** * * @author sarah */ public class R129 { public static void main(String[] ar...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
389fcc184b2d2c6b7043f6e2c647aeaa
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.util.Scanner; public class Elephant { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num1 = Integer.MAX_VALUE; int n = sc.nextInt(); int a, fin; a = fin = 0; boolean correcto = true; for(int i=0; i<n; i++) { a = sc.nextInt(); if(a < num1) { num1 = ...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
766c0cf8275881b46685df8f461673ec
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.util.Scanner; public class elehant { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int menor, cont = 0; int pos = 0; menor = s.nextInt(); int[] n1 = new int[n]; for (int i = 1; i < n;...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
ea5f36754ab2842745454e353b54fce0
train_000.jsonl
1342020600
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend much time on travelling, so for his journey he will choose a town that needs minimum time...
256 megabytes
import java.io.PrintStream; import java.util.Scanner; public class Main { public static void main( String[] args ) { new CodeForces_205A().doit(); } } class CodeForces_205A { Scanner sc; PrintStream ps; public void doit() { sc = new Scanner( System.in ); ps = System.out; int n = sc.nextInt(...
Java
["2\n7 4", "7\n7 4 47 100 4 9 12"]
2 seconds
["2", "Still Rozdil"]
NoteIn the first sample there are only two cities where the Little Elephant can go. The travel time for the first town equals 7, to the second one — 4. The town which is closest to Rodzil (the only one) is the second one, so the answer is 2.In the second sample the closest cities are cities two and five, the travelling...
Java 6
standard input
[ "implementation", "brute force" ]
ce68f1171d9972a1b40b0450a05aa9cd
The first line contains a single integer n (1 ≤ n ≤ 105) — the number of cities. The next line contains n integers, separated by single spaces: the i-th integer represents the time needed to go from town Rozdil to the i-th town. The time values are positive integers, not exceeding 109. You can consider the cities numbe...
900
Print the answer on a single line — the number of the town the Little Elephant will go to. If there are multiple cities with minimum travel time, print "Still Rozdil" (without the quotes).
standard output
PASSED
22420e63cf372c80397eb91f0adb18ce
train_000.jsonl
1570957500
There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["6 1\nBWBBWW", "7 3\nWBWBWBW", "6 4\nBWBWBW"]
1 second
["WBBBWW", "WWWWWWW", "BWBWBW"]
NoteThe first example is described in the statement.The second example: "WBWBWBW" $$$\rightarrow$$$ "WWBWBWW" $$$\rightarrow$$$ "WWWBWWW" $$$\rightarrow$$$ "WWWWWWW". So all chips become white.The third example: "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ ...
Java 8
standard input
[ "constructive algorithms", "implementation" ]
86d17fa4bac5edd0cc4b6bff1c9899b7
The first line contains two integers $$$n$$$ and $$$k$$$ $$$(3 \le n \le 200\,000, 1 \le k \le 10^{9})$$$ — the number of chips and the number of iterations, respectively. The second line contains a string consisting of $$$n$$$ characters "W" and "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th chip is whit...
2,300
Print a string consisting of $$$n$$$ characters "W" and "B". If after $$$k$$$ iterations the $$$i$$$-th chip is white, then the $$$i$$$-th character should be "W". Otherwise the $$$i$$$-th character should be "B".
standard output
PASSED
1e0c248b62e63b9ae405282b4472fdeb
train_000.jsonl
1570957500
There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw...
256 megabytes
//package com.company; import java.io.*; import java.util.*; public class Main { public static class Task { public String get(int[] input, int offset) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < input.length; i++) { char truePos = input[(i + input...
Java
["6 1\nBWBBWW", "7 3\nWBWBWBW", "6 4\nBWBWBW"]
1 second
["WBBBWW", "WWWWWWW", "BWBWBW"]
NoteThe first example is described in the statement.The second example: "WBWBWBW" $$$\rightarrow$$$ "WWBWBWW" $$$\rightarrow$$$ "WWWBWWW" $$$\rightarrow$$$ "WWWWWWW". So all chips become white.The third example: "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ ...
Java 8
standard input
[ "constructive algorithms", "implementation" ]
86d17fa4bac5edd0cc4b6bff1c9899b7
The first line contains two integers $$$n$$$ and $$$k$$$ $$$(3 \le n \le 200\,000, 1 \le k \le 10^{9})$$$ — the number of chips and the number of iterations, respectively. The second line contains a string consisting of $$$n$$$ characters "W" and "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th chip is whit...
2,300
Print a string consisting of $$$n$$$ characters "W" and "B". If after $$$k$$$ iterations the $$$i$$$-th chip is white, then the $$$i$$$-th character should be "W". Otherwise the $$$i$$$-th character should be "B".
standard output
PASSED
ff6d888bc7ef247f9acd0121a55c47ca
train_000.jsonl
1570957500
There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class F { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); StringTokenizer st = new StringTok...
Java
["6 1\nBWBBWW", "7 3\nWBWBWBW", "6 4\nBWBWBW"]
1 second
["WBBBWW", "WWWWWWW", "BWBWBW"]
NoteThe first example is described in the statement.The second example: "WBWBWBW" $$$\rightarrow$$$ "WWBWBWW" $$$\rightarrow$$$ "WWWBWWW" $$$\rightarrow$$$ "WWWWWWW". So all chips become white.The third example: "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ ...
Java 8
standard input
[ "constructive algorithms", "implementation" ]
86d17fa4bac5edd0cc4b6bff1c9899b7
The first line contains two integers $$$n$$$ and $$$k$$$ $$$(3 \le n \le 200\,000, 1 \le k \le 10^{9})$$$ — the number of chips and the number of iterations, respectively. The second line contains a string consisting of $$$n$$$ characters "W" and "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th chip is whit...
2,300
Print a string consisting of $$$n$$$ characters "W" and "B". If after $$$k$$$ iterations the $$$i$$$-th chip is white, then the $$$i$$$-th character should be "W". Otherwise the $$$i$$$-th character should be "B".
standard output
PASSED
da2120b128705fb0b108abe1351650e2
train_000.jsonl
1570957500
There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw...
256 megabytes
//package round592; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class F { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), K = n...
Java
["6 1\nBWBBWW", "7 3\nWBWBWBW", "6 4\nBWBWBW"]
1 second
["WBBBWW", "WWWWWWW", "BWBWBW"]
NoteThe first example is described in the statement.The second example: "WBWBWBW" $$$\rightarrow$$$ "WWBWBWW" $$$\rightarrow$$$ "WWWBWWW" $$$\rightarrow$$$ "WWWWWWW". So all chips become white.The third example: "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ ...
Java 8
standard input
[ "constructive algorithms", "implementation" ]
86d17fa4bac5edd0cc4b6bff1c9899b7
The first line contains two integers $$$n$$$ and $$$k$$$ $$$(3 \le n \le 200\,000, 1 \le k \le 10^{9})$$$ — the number of chips and the number of iterations, respectively. The second line contains a string consisting of $$$n$$$ characters "W" and "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th chip is whit...
2,300
Print a string consisting of $$$n$$$ characters "W" and "B". If after $$$k$$$ iterations the $$$i$$$-th chip is white, then the $$$i$$$-th character should be "W". Otherwise the $$$i$$$-th character should be "B".
standard output