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
bd260c0c396466f639e8b0a82fc19390
train_000.jsonl
1382715000
Seryozha has a very changeable character. This time he refused to leave the room to Dima and his girlfriend (her hame is Inna, by the way). However, the two lovebirds can always find a way to communicate. Today they are writing text messages to each other.Dima and Inna are using a secret code in their text messages. Wh...
256 megabytes
import java.util.*; public class Main { void solve() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] list = new String[n]; for( int i = 0; i < n; ++i ) { list[i] = sc.next(); } String letter = sc.next(); String heart = "<3"; int i = 0; int p = 0; while( p < letter...
Java
["3\ni\nlove\nyou\n&lt;3i&lt;3love&lt;23you&lt;3", "7\ni\nam\nnot\nmain\nin\nthe\nfamily\n&lt;3i&lt;&gt;3am&lt;3the&lt;3&lt;main&lt;3in&lt;3the&lt;3&gt;&lt;3family&lt;3"]
2 seconds
["yes", "no"]
NotePlease note that Dima got a good old kick in the pants for the second sample from the statement.
Java 7
standard input
[ "brute force", "strings" ]
36fb3a01860ef0cc2a1065d78e4efbd5
The first line contains integer n (1 ≤ n ≤ 105) — the number of words in Dima's message. Next n lines contain non-empty words, one word per line. The words only consist of small English letters. The total length of all words doesn't exceed 105. The last line contains non-empty text message that Inna has got. The numbe...
1,500
In a single line, print "yes" (without the quotes), if Dima decoded the text message correctly, and "no" (without the quotes) otherwise.
standard output
PASSED
30966e88da4aa7067d0c29cbdca67c7d
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.util.Scanner; import java.util.*; public class code1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while (--t>=0) { int n=sc.nextInt(); long x=sc.nextInt(); long[]z=new long[n]; for (int i=0;i<n;i++) { z[i]=sc.nextInt(); ...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
065b6642c11e2cac7e489ba8cfc1757f
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.util.*; public class ZeroArray { public long n; public long k; public long[] a; public ZeroArray(long n, long k, long[] a) { this.n = n; this.k = k; this.a = a; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); ...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
9f6af1f4878c9ecbebf9bf6ab4d39fd1
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String commandLineArgument[]){ FS input = new FS(); PrintWriter out = new PrintWriter(System.out); int tc = input.nextInt(); while(tc --> 0){ int n = input.nextInt(); long k = ...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
45130fcb8fbda5bbb9da276caa5f1721
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String commandLineArgument[]){ FS input = new FS(); PrintWriter out = new PrintWriter(System.out); int tc = input.nextInt(); while(tc --> 0){ int n = input.nextInt(); long k = ...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
9ee6773d7f340c76c459d936647faa86
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String commandLineArgument[]){ FS input = new FS(); PrintWriter out = new PrintWriter(System.out); int tc = input.nextInt(); while(tc --> 0){ int n = input.nextInt(); long k = ...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
ed43b3e4c5b5a79bd70116dba94ce6be
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String commandLineArgument[]){ FS input = new FS(); PrintWriter out = new PrintWriter(System.out); int tc = input.nextInt(); while(tc --> 0){ int n = input.nextInt(); long k = ...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
b73033a8544287dfb2b8cde3d910b85c
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String commandLineArgument[]){ FS input = new FS(); PrintWriter out = new PrintWriter(System.out); int tc = input.nextInt(); while(tc --> 0){ int n = input.nextInt(); long k = ...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
4c5268f0dd57643528b83027c6ec88c8
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class stone { public static void main(String args[]) throws IOException { FastReader sc = new FastReader(); BufferedWriter w = new BufferedWriter(new PrintWriter(Sy...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
c1644528b2b3834021ca6ea0ae2564f4
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.io.BufferedReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; import java.io.InputStreamReader; import java.io.IOException; public class codeforces { public static void main(String[] args) { scanner in = new scanner();...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
f773cccb3b419416517ebdcdaac2edba
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class CodeForcesZeroRemainderArray { public static void main(String[] args) throws NumberFormatException, IOException { // TODO Auto-generated method stub BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int t=Inte...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
e25f1251b100ee0ac531900020db8071
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
//package com.company; //import com.sun.tools.corba.se.idl.StructEntry; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class Main{ public static void main(String[] args) throws IOException { BufferedReade...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
eedaa6c0fbefe93caafdfaa60e98acd1
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*;; import java.util.StringTokenizer; public class zra2 { public static void main(String args[]) { FastReader s=new FastReader(); int t=s.nextInt(); int i,n,k,arr[],x,sum=0,...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
87dd52b569e5ea1e8e7d58bdd7399d3e
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.io.*; import java.util.*; public class Main { static Scanner scan = new Scanner(System.in); public static void solve() throws Exception { //BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); //StringTokenizer tk = new StringTokenizer(in.readLine()); int n = scan.nextInt(); ...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
e51d42fd55cce0faa66e4a03ca8043ad
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class ZeroRemainderArray{ public static class FastReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; pu...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
eb4b98bc0d0912fa7e1e2842649264aa
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
/* 盗图小能手 ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
dbdacb5495e5f6740b42ce13b9e07822
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int test_case = scanner.nextInt(); for(int i = 0; i < test_case; ++i) { int n = scanner.nextInt(); long k =...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
8c0e322c144beec5b6f11d1546306f6f
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.io.*; import java.util.*; import javafx.util.Pair; import java.math.*; import java.math.BigInteger; import java.util.LinkedList; import java.util.Queue; public final class CodeForces { static StringBuilder ans=new StringBuilder(); static FastReader in=new FastReader(); static ArrayList<Ar...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
753be82a1fbb07d13155dc2338041a0d
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class D { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
980137190cb961cfba10d6d00ab78edd
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
//package src; import java.util.Scanner; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.PriorityQueue; import java.util.Queue; import java.util.Stack; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.ArrayList; import java.util.Arrays; import...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
dce796cfd1b8b07fab3e7ea211d4af5a
train_000.jsonl
1593354900
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers.Initially, you have an integer $$$x = 0$$$. During one move, you can do one of the following two operations: Choose exactly one $$$i$$$ from $$$1$$$ to $$$n$$$ and increase $$$a_i$$$ by $$$x$$$ ($$$a_i := a_i + x$$$), then increase $$$x$$$ by $$$1$...
256 megabytes
//package src; import java.util.Scanner; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.PriorityQueue; import java.util.Queue; import java.util.Stack; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.ArrayList; import java.util.Arrays; import...
Java
["5\n4 3\n1 2 1 3\n10 6\n8 7 1 8 3 7 5 10 8 9\n5 10\n20 100 50 20 100500\n10 25\n24 24 24 24 24 24 24 24 24 24\n8 8\n1 2 3 4 5 6 7 8"]
2 seconds
["6\n18\n0\n227\n8"]
NoteConsider the first test case of the example: $$$x=0$$$, $$$a = [1, 2, 1, 3]$$$. Just increase $$$x$$$; $$$x=1$$$, $$$a = [1, 2, 1, 3]$$$. Add $$$x$$$ to the second element and increase $$$x$$$; $$$x=2$$$, $$$a = [1, 3, 1, 3]$$$. Add $$$x$$$ to the third element and increase $$$x$$$; $$$x=3$$$, $$$a = [1, 3, 3, ...
Java 8
standard input
[ "two pointers", "sortings", "math" ]
a8b4c115bedda3847e7c2e3620e3e19b
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 2 \cdot 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5; 1 \le k \le 10^9$$$) — the length of $$$a$$$ and the required divi...
1,400
For each test case, print the answer — the minimum number of moves required to obtain such an array that each its element is divisible by $$$k$$$.
standard output
PASSED
2cfd0e064b6b2f3f89783b8063318627
train_000.jsonl
1475330700
You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59.You are given a time in format HH:MM that is currently displayed on the broken cl...
256 megabytes
import java.util.Scanner; public class a { public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt(); if(n==12) { String s = in.next(); String a[]=s.split(":"); int b1=Integer.valueOf(a[0]); int b2=Integer.valueOf(a[1]); if(b1>12) { ...
Java
["24\n17:30", "12\n17:30", "24\n99:99"]
1 second
["17:30", "07:30", "09:09"]
null
Java 8
standard input
[ "implementation", "brute force" ]
88d56c1e3a7ffa94354ce0c70d8e958f
The first line of the input contains one integer 12 or 24, that denote 12-hours or 24-hours format respectively. The second line contains the time in format HH:MM, that is currently displayed on the clock. First two characters stand for the hours, while next two show the minutes.
1,300
The only line of the output should contain the time in format HH:MM that is a correct time in the given format. It should differ from the original in as few positions as possible. If there are many optimal solutions you can print any of them.
standard output
PASSED
31275330b5d5b8986ab3f1b6b64a0642
train_000.jsonl
1475330700
You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59.You are given a time in format HH:MM that is currently displayed on the broken cl...
256 megabytes
import java.text.DecimalFormat; import java.util.Scanner; public class A { public static void main(String[] args) { Scanner scan = new Scanner(System.in); DecimalFormat f = new DecimalFormat("00"); int n = scan.nextInt(); String[] split = scan.next().split("[:]"); int h = Integer.parseInt(split[0]), m = In...
Java
["24\n17:30", "12\n17:30", "24\n99:99"]
1 second
["17:30", "07:30", "09:09"]
null
Java 8
standard input
[ "implementation", "brute force" ]
88d56c1e3a7ffa94354ce0c70d8e958f
The first line of the input contains one integer 12 or 24, that denote 12-hours or 24-hours format respectively. The second line contains the time in format HH:MM, that is currently displayed on the clock. First two characters stand for the hours, while next two show the minutes.
1,300
The only line of the output should contain the time in format HH:MM that is a correct time in the given format. It should differ from the original in as few positions as possible. If there are many optimal solutions you can print any of them.
standard output
PASSED
c6dd2feaf0447d48049efc50d9f138ab
train_000.jsonl
1475330700
You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59.You are given a time in format HH:MM that is currently displayed on the broken cl...
256 megabytes
import java.util.*; import java.math.*; public class clockA { public static void main(String args[]) { Scanner in = new Scanner(System.in); int format = in.nextInt(); in.nextLine(); String time = in.nextLine(); int hour1 = Integer.parseInt(time.substring(0, 1)); int hour2 = Integer.parseInt(time.substring(...
Java
["24\n17:30", "12\n17:30", "24\n99:99"]
1 second
["17:30", "07:30", "09:09"]
null
Java 8
standard input
[ "implementation", "brute force" ]
88d56c1e3a7ffa94354ce0c70d8e958f
The first line of the input contains one integer 12 or 24, that denote 12-hours or 24-hours format respectively. The second line contains the time in format HH:MM, that is currently displayed on the clock. First two characters stand for the hours, while next two show the minutes.
1,300
The only line of the output should contain the time in format HH:MM that is a correct time in the given format. It should differ from the original in as few positions as possible. If there are many optimal solutions you can print any of them.
standard output
PASSED
3542c3c85040dd5672a3b28b761b461a
train_000.jsonl
1475330700
You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59.You are given a time in format HH:MM that is currently displayed on the broken cl...
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.StringTokenizer; public class A { public static int dist(String s, String s2) { int c = 0; for (int i = 0; i < s.length(); i++) { if (s.charAt(...
Java
["24\n17:30", "12\n17:30", "24\n99:99"]
1 second
["17:30", "07:30", "09:09"]
null
Java 8
standard input
[ "implementation", "brute force" ]
88d56c1e3a7ffa94354ce0c70d8e958f
The first line of the input contains one integer 12 or 24, that denote 12-hours or 24-hours format respectively. The second line contains the time in format HH:MM, that is currently displayed on the clock. First two characters stand for the hours, while next two show the minutes.
1,300
The only line of the output should contain the time in format HH:MM that is a correct time in the given format. It should differ from the original in as few positions as possible. If there are many optimal solutions you can print any of them.
standard output
PASSED
cc11f0a04642ab9a9c3a0989bd22a2b5
train_000.jsonl
1475330700
You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59.You are given a time in format HH:MM that is currently displayed on the broken cl...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int format = Integer.parseIn...
Java
["24\n17:30", "12\n17:30", "24\n99:99"]
1 second
["17:30", "07:30", "09:09"]
null
Java 8
standard input
[ "implementation", "brute force" ]
88d56c1e3a7ffa94354ce0c70d8e958f
The first line of the input contains one integer 12 or 24, that denote 12-hours or 24-hours format respectively. The second line contains the time in format HH:MM, that is currently displayed on the clock. First two characters stand for the hours, while next two show the minutes.
1,300
The only line of the output should contain the time in format HH:MM that is a correct time in the given format. It should differ from the original in as few positions as possible. If there are many optimal solutions you can print any of them.
standard output
PASSED
e11a54273fd3016f12bcc43ade67b70e
train_000.jsonl
1475330700
You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59.You are given a time in format HH:MM that is currently displayed on the broken cl...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.Queu...
Java
["24\n17:30", "12\n17:30", "24\n99:99"]
1 second
["17:30", "07:30", "09:09"]
null
Java 8
standard input
[ "implementation", "brute force" ]
88d56c1e3a7ffa94354ce0c70d8e958f
The first line of the input contains one integer 12 or 24, that denote 12-hours or 24-hours format respectively. The second line contains the time in format HH:MM, that is currently displayed on the clock. First two characters stand for the hours, while next two show the minutes.
1,300
The only line of the output should contain the time in format HH:MM that is a correct time in the given format. It should differ from the original in as few positions as possible. If there are many optimal solutions you can print any of them.
standard output
PASSED
5f9a3f1133ac2730d10f5b1389d179e4
train_000.jsonl
1475330700
You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59.You are given a time in format HH:MM that is currently displayed on the broken cl...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); long start = System.currentTimeMillis(); long fin = System.currentTimeMillis(); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void ...
Java
["24\n17:30", "12\n17:30", "24\n99:99"]
1 second
["17:30", "07:30", "09:09"]
null
Java 8
standard input
[ "implementation", "brute force" ]
88d56c1e3a7ffa94354ce0c70d8e958f
The first line of the input contains one integer 12 or 24, that denote 12-hours or 24-hours format respectively. The second line contains the time in format HH:MM, that is currently displayed on the clock. First two characters stand for the hours, while next two show the minutes.
1,300
The only line of the output should contain the time in format HH:MM that is a correct time in the given format. It should differ from the original in as few positions as possible. If there are many optimal solutions you can print any of them.
standard output
PASSED
4631ac48995d3c36c0efdb8ad2edc1fd
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) throws Exception{ Scanner sc = new Scanner(System.in); int n=sc.nextInt(); int[] mas = new int[n]; List<Integer> masL = new ArrayList<>(); int max=0; int temp...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
25ab93089418dcb29851ec7621977153
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.util.*; public class PetyaAndCountryside { static int countIrrigated(int[] h, int pos) { int cnt = 1; // (pos, n) for (int i = pos + 1; i < h.length && h[i] <= h[i - 1]; ++i) ++cnt; // [0, pos) for (int i = pos - 1; i >= 0 && h[i] <= h[i + 1]; --i) ++cnt; return cnt; } public stati...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
c97daba411f32206703364e1374ea9d8
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.util.Scanner; public class PetyaAndCountryside { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; int m = 0; for (int i = 0; i < n; i++) a[i] = in.nextInt(); for (in...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
6e4a2e7412210d756ee9cb500e7676d9
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.util.Scanner; public class B_66_Petya_And_Countryside { public static void main(String[] args){ Scanner input=new Scanner(System.in); int n=input.nextInt(); int[] height=new int[n]; int i; for(i=0;i<n;i++) height[i]=input.nextInt(); int max=0; int count=0; int j; for(i=0;i<n;i++){ ...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
0ef7b32f3d22d69cd2fb11763c6518ee
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.util.Scanner; public class B { static int n; static int a[]; public static void main(String[] args) { Scanner sc= new Scanner(System.in); n=sc.nextInt(); a=new int [n]; for (int i = 0; i < a.length; i++) { a[i]=sc.nextInt(); } int max=0; for (int i = 0; i < a.length; i++) { max=Math.max(ma...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
88f90c241e7ca2431e41542e32638c7d
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class PetyaandCountryside { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); i...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
ae6bec3c6a5ef9dd1f4ff06830e02b0a
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author alex */ pub...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
d4d14e2f1e1349a7d32cc79629438766
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.util.*; import java.lang.reflect.Array; import java.math.*; import java.io.*; import java.awt.*; import java.awt.geom.AffineTransform; public class Main{ static FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter out = new PrintWriter(System.out)...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
c4e3df32dd4d173bd3f9cf9b7921daf6
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.util.Scanner; public class PetyaCountryside { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = in.nextInt(...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
42f2f3f0fb093f912c6de9d41b55bc5d
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Reader.init(System.in); int n = Reader.nextInt() ; int [] a = new int [n] ; int temp = 0 , counter = 1 , max = 0 ; for (int i=0 ; i<a.l...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
0c437a519fa41d204af2bb51aa96025e
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
/* * @author Sane */ import java.util.*; import java.util.Scanner; import java.io.File; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.FileOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.OutputStreamWriter; impor...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
995d172278aa12f682ab29fb005b297d
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.awt.Point; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class Solution implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); ...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
ff4c7a87041c996357326b3d8a276868
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.util.*; import java.io.*; public class Main{ BufferedReader in; StringTokenizer str = null; PrintWriter out; private String next() throws Exception{ while (str == null || !str.hasMoreElements()) str = new StringTokenizer(in.readLine()); return str.nextToken(); } ...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
f5c1c89295b5175de50b720db8f62b44
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.io.*; import java.util.*; public class j { public static void main(String aa[])throws IOException { BufferedReader b=new BufferedReader(new InputStreamReader(System.in)); int v=0,l=0,n=0,k=0,p=0,j=0,m=0,t=1,i=0; String s,r; p=Integer.parseInt(b.readLine()); int d[]; d=new int[p]; s=b.readLine(); StringToken...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
4ee404b2b7194d8496349c8c8dd69cf2
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.util.*; public class Main { static int height[],n; public static void main(String[] args) { Scanner s = new Scanner(System.in); n = s.nextInt(); height = new int[n]; for (int i = 0;i < n;i++) height[i] = s.nextInt(); int max = 0,res; ...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
9eda1d87ae0cf4f998dae59385c12b62
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Task66B { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(in.r...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
2966e59ffe2462dfb160a194e4a7d2eb
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String ar[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int arr[] = new int[n]; for (int i = 0; i < arr.length; i++) { arr[i] = in.nextInt(); } int max = -1; for (int i = 0; i < arr.length; i++) { int cnt = 1;...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
ab4eac628f3f2354de516738dcf53561
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; pub...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
a3ae8c9fff08d9d316b0e2d57eed8447
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class PetyaAndCountryside { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine(...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
f6d2cdb6cc5fd4c0daab861ddf163f2e
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
/** * Created by icon on 1/20/2016. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class CF66B { public static void main(String[] args) ...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
d13bd267806dfc917291ac8d96dbad57
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
/** * Created by icon on 1/20/2016. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class CF66B { public static void main(String[] args) ...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
5db5af555bb040569006e4a507481b1a
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** *...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
e181b084cc8db85599cb62645bc7d4e6
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.StringTokenizer; public class Main { private BufferedReader reader; private StringTokenizer tokenizer; private PrintWriter pw; void solve() thr...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
45331bc38acf7a2880353701e761e50c
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; /** * * @author Prateep */ public class JavaApplication1 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here InputStream inputStr...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
9f70692b1f905aff3088a6922ea3c5d3
train_000.jsonl
1299513600
Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed h...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; /** * * @author Prateep */ public class JavaApplication1 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here InputStream inputStr...
Java
["1\n2", "5\n1 2 1 2 1", "8\n1 2 1 1 1 3 3 4"]
2 seconds
["1", "3", "6"]
null
Java 7
standard input
[ "implementation", "brute force" ]
5d11fa8528f1dc873d50b3417bef8c79
The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.
1,100
Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.
standard output
PASSED
02cb98df0b2bbcf8ab0fdf74fc044f1a
train_000.jsonl
1397376000
Good old Berland has n cities and m roads. Each road connects a pair of distinct cities and is bidirectional. Between any pair of cities, there is at most one road. For each road, we know its length.We also know that the President will soon ride along the Berland roads from city s to city t. Naturally, he will choose o...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class E { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); int[][] graph = new int[n][n]; for (int i = 0; i < n; i++) Arrays.fill(graph[i], Integer.MAX_VALUE); for (int k = 0; k ...
Java
["5 6\n1 2 1\n2 3 1\n3 4 1\n4 1 1\n2 4 2\n4 5 4"]
4 seconds
["1 4 1 2 1 5 6 1 2 1"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
ec1a4656256b09cf1c6050977fbc6cb9
The first line of the input contains integers n, m (2 ≤ n ≤ 500, 0 ≤ m ≤ n·(n - 1) / 2) — the number of cities and roads, correspondingly. Then m lines follow, containing the road descriptions, one description per line. Each description contains three integers xi, yi, li (1 ≤ xi, yi ≤ n, xi ≠ yi, 1 ≤ li ≤ 106), where x...
2,500
Print the sequence of integers c12, c13, ..., c1n, c23, c24, ..., c2n, ..., cn - 1, n, where cst is the number of roads that can lie on the shortest path from s to t. Print the elements of sequence c in the described order. If the pair of cities s and t don't have a path between them, then cst = 0.
standard output
PASSED
90a9819b0018ee2276fa0725bb680f07
train_000.jsonl
1397376000
Good old Berland has n cities and m roads. Each road connects a pair of distinct cities and is bidirectional. Between any pair of cities, there is at most one road. For each road, we know its length.We also know that the President will soon ride along the Berland roads from city s to city t. Naturally, he will choose o...
256 megabytes
import java.io.BufferedReader; import java.io.IOError; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class Div2TaskE { FastIO scan = new ...
Java
["5 6\n1 2 1\n2 3 1\n3 4 1\n4 1 1\n2 4 2\n4 5 4"]
4 seconds
["1 4 1 2 1 5 6 1 2 1"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
ec1a4656256b09cf1c6050977fbc6cb9
The first line of the input contains integers n, m (2 ≤ n ≤ 500, 0 ≤ m ≤ n·(n - 1) / 2) — the number of cities and roads, correspondingly. Then m lines follow, containing the road descriptions, one description per line. Each description contains three integers xi, yi, li (1 ≤ xi, yi ≤ n, xi ≠ yi, 1 ≤ li ≤ 106), where x...
2,500
Print the sequence of integers c12, c13, ..., c1n, c23, c24, ..., c2n, ..., cn - 1, n, where cst is the number of roads that can lie on the shortest path from s to t. Print the elements of sequence c in the described order. If the pair of cities s and t don't have a path between them, then cst = 0.
standard output
PASSED
4e159e4ad43a9a0b48a1a7ac369aa5b4
train_000.jsonl
1397376000
Good old Berland has n cities and m roads. Each road connects a pair of distinct cities and is bidirectional. Between any pair of cities, there is at most one road. For each road, we know its length.We also know that the President will soon ride along the Berland roads from city s to city t. Naturally, he will choose o...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Main mainClass = new Main(); } BufferedReader in; P...
Java
["5 6\n1 2 1\n2 3 1\n3 4 1\n4 1 1\n2 4 2\n4 5 4"]
4 seconds
["1 4 1 2 1 5 6 1 2 1"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
ec1a4656256b09cf1c6050977fbc6cb9
The first line of the input contains integers n, m (2 ≤ n ≤ 500, 0 ≤ m ≤ n·(n - 1) / 2) — the number of cities and roads, correspondingly. Then m lines follow, containing the road descriptions, one description per line. Each description contains three integers xi, yi, li (1 ≤ xi, yi ≤ n, xi ≠ yi, 1 ≤ li ≤ 106), where x...
2,500
Print the sequence of integers c12, c13, ..., c1n, c23, c24, ..., c2n, ..., cn - 1, n, where cst is the number of roads that can lie on the shortest path from s to t. Print the elements of sequence c in the described order. If the pair of cities s and t don't have a path between them, then cst = 0.
standard output
PASSED
dccda442e3ffe0dd43be3b616dbefa31
train_000.jsonl
1397376000
Good old Berland has n cities and m roads. Each road connects a pair of distinct cities and is bidirectional. Between any pair of cities, there is at most one road. For each road, we know its length.We also know that the President will soon ride along the Berland roads from city s to city t. Naturally, he will choose o...
256 megabytes
import java.util.*; import java.io.*; public class Main{ BufferedReader in; StringTokenizer str = null; PrintWriter out; private String next() throws Exception{ while(str == null || !str.hasMoreElements()) str = new StringTokenizer(in.readLine()); return str.nextToken(); } private int next...
Java
["5 6\n1 2 1\n2 3 1\n3 4 1\n4 1 1\n2 4 2\n4 5 4"]
4 seconds
["1 4 1 2 1 5 6 1 2 1"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
ec1a4656256b09cf1c6050977fbc6cb9
The first line of the input contains integers n, m (2 ≤ n ≤ 500, 0 ≤ m ≤ n·(n - 1) / 2) — the number of cities and roads, correspondingly. Then m lines follow, containing the road descriptions, one description per line. Each description contains three integers xi, yi, li (1 ≤ xi, yi ≤ n, xi ≠ yi, 1 ≤ li ≤ 106), where x...
2,500
Print the sequence of integers c12, c13, ..., c1n, c23, c24, ..., c2n, ..., cn - 1, n, where cst is the number of roads that can lie on the shortest path from s to t. Print the elements of sequence c in the described order. If the pair of cities s and t don't have a path between them, then cst = 0.
standard output
PASSED
07618055a64be6753044f4903dff54fd
train_000.jsonl
1397376000
Good old Berland has n cities and m roads. Each road connects a pair of distinct cities and is bidirectional. Between any pair of cities, there is at most one road. For each road, we know its length.We also know that the President will soon ride along the Berland roads from city s to city t. Naturally, he will choose o...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String line = scanner.nextLine(); String[] strNM = line.split(" "); int vNumber = Integer.parseInt(strNM[0]); int eNumber = Integer.parseInt(strNM[1]);...
Java
["5 6\n1 2 1\n2 3 1\n3 4 1\n4 1 1\n2 4 2\n4 5 4"]
4 seconds
["1 4 1 2 1 5 6 1 2 1"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
ec1a4656256b09cf1c6050977fbc6cb9
The first line of the input contains integers n, m (2 ≤ n ≤ 500, 0 ≤ m ≤ n·(n - 1) / 2) — the number of cities and roads, correspondingly. Then m lines follow, containing the road descriptions, one description per line. Each description contains three integers xi, yi, li (1 ≤ xi, yi ≤ n, xi ≠ yi, 1 ≤ li ≤ 106), where x...
2,500
Print the sequence of integers c12, c13, ..., c1n, c23, c24, ..., c2n, ..., cn - 1, n, where cst is the number of roads that can lie on the shortest path from s to t. Print the elements of sequence c in the described order. If the pair of cities s and t don't have a path between them, then cst = 0.
standard output
PASSED
0b190f0b1f53d38fe86eec2e7b35599f
train_000.jsonl
1397376000
Good old Berland has n cities and m roads. Each road connects a pair of distinct cities and is bidirectional. Between any pair of cities, there is at most one road. For each road, we know its length.We also know that the President will soon ride along the Berland roads from city s to city t. Naturally, he will choose o...
256 megabytes
//Author: net12k44 import java.io.*; import java.util.*; //public class Main{//} void print(int a[][]){ for(int d[]: a){ for(int x: d) out.print(x+" "); out.println(); } } private void solve() { int n = in.nextInt(), m = in.nextInt(); int a[][] = new int[n][n], c[][] = new int[n][n]; final int oo = 1000000...
Java
["5 6\n1 2 1\n2 3 1\n3 4 1\n4 1 1\n2 4 2\n4 5 4"]
4 seconds
["1 4 1 2 1 5 6 1 2 1"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
ec1a4656256b09cf1c6050977fbc6cb9
The first line of the input contains integers n, m (2 ≤ n ≤ 500, 0 ≤ m ≤ n·(n - 1) / 2) — the number of cities and roads, correspondingly. Then m lines follow, containing the road descriptions, one description per line. Each description contains three integers xi, yi, li (1 ≤ xi, yi ≤ n, xi ≠ yi, 1 ≤ li ≤ 106), where x...
2,500
Print the sequence of integers c12, c13, ..., c1n, c23, c24, ..., c2n, ..., cn - 1, n, where cst is the number of roads that can lie on the shortest path from s to t. Print the elements of sequence c in the described order. If the pair of cities s and t don't have a path between them, then cst = 0.
standard output
PASSED
a812e79f2a6875e01c0d079f32d5de95
train_000.jsonl
1397376000
Good old Berland has n cities and m roads. Each road connects a pair of distinct cities and is bidirectional. Between any pair of cities, there is at most one road. For each road, we know its length.We also know that the President will soon ride along the Berland roads from city s to city t. Naturally, he will choose o...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.PriorityQueue; import java.util.StringTokenizer; public ...
Java
["5 6\n1 2 1\n2 3 1\n3 4 1\n4 1 1\n2 4 2\n4 5 4"]
4 seconds
["1 4 1 2 1 5 6 1 2 1"]
null
Java 7
standard input
[ "dp", "graphs", "shortest paths" ]
ec1a4656256b09cf1c6050977fbc6cb9
The first line of the input contains integers n, m (2 ≤ n ≤ 500, 0 ≤ m ≤ n·(n - 1) / 2) — the number of cities and roads, correspondingly. Then m lines follow, containing the road descriptions, one description per line. Each description contains three integers xi, yi, li (1 ≤ xi, yi ≤ n, xi ≠ yi, 1 ≤ li ≤ 106), where x...
2,500
Print the sequence of integers c12, c13, ..., c1n, c23, c24, ..., c2n, ..., cn - 1, n, where cst is the number of roads that can lie on the shortest path from s to t. Print the elements of sequence c in the described order. If the pair of cities s and t don't have a path between them, then cst = 0.
standard output
PASSED
e6139d4cba54a893852bf12ac8e514f3
train_000.jsonl
1411918500
There are some tasks which have the following structure: you are given a model, and you can do some operations, you should use these operations to achive the goal. One way to create a new task is to use the same model and same operations, but change the goal.Let's have a try. I have created the following task for Topco...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; /** * Created by Darren on 14-9-29. */ public class Main { Reader in = new Reader(System.in); PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) throws IOException {...
Java
["2\n3 5\n6 0", "5\n0 0 0 0 0\n1 2 3 4 5", "3\n4 5 6\n1 2 3", "3\n1 2 3\n4 5 6"]
2 seconds
["2\n1 2\n2 2", "-1", "5\n3 1\n1 2\n2 2\n2 3\n3 1", "-1"]
NoteAssignment a ^= b denotes assignment a = a ^ b, where operation "^" is bitwise XOR of two integers.
Java 7
standard input
[ "constructive algorithms", "math", "matrices" ]
dcb55324681dd1916449570d6bc64e47
The first line contains an integer n (1 ≤ n ≤ 10000). The second line contains n integers: x1 to xn (0 ≤ xi ≤ 109). The third line contains n integers: y1 to yn (0 ≤ yi ≤ 109).
2,700
If there is no solution, output -1. If there is a solution, then in the first line output an integer m (0 ≤ m ≤ 1000000) – the number of assignments you need to perform. Then print m lines, each line should contain two integers i and j (1 ≤ i, j ≤ n), which denote assignment xi ^= xj. If there are multiple solutions yo...
standard output
PASSED
83ca23fb2fd6c48e26ef07c4d69403fc
train_000.jsonl
1411918500
There are some tasks which have the following structure: you are given a model, and you can do some operations, you should use these operations to achive the goal. One way to create a new task is to use the same model and same operations, but change the goal.Let's have a try. I have created the following task for Topco...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; /** * CodeForces 472F - Design Tutorial: Change the Goal * Created by Darren on 14-9-29. * O(n^2) time and O(n^2) space. * * Tag: linear algebra, xor */ public class Main { Reader in = new Reader(System.in...
Java
["2\n3 5\n6 0", "5\n0 0 0 0 0\n1 2 3 4 5", "3\n4 5 6\n1 2 3", "3\n1 2 3\n4 5 6"]
2 seconds
["2\n1 2\n2 2", "-1", "5\n3 1\n1 2\n2 2\n2 3\n3 1", "-1"]
NoteAssignment a ^= b denotes assignment a = a ^ b, where operation "^" is bitwise XOR of two integers.
Java 7
standard input
[ "constructive algorithms", "math", "matrices" ]
dcb55324681dd1916449570d6bc64e47
The first line contains an integer n (1 ≤ n ≤ 10000). The second line contains n integers: x1 to xn (0 ≤ xi ≤ 109). The third line contains n integers: y1 to yn (0 ≤ yi ≤ 109).
2,700
If there is no solution, output -1. If there is a solution, then in the first line output an integer m (0 ≤ m ≤ 1000000) – the number of assignments you need to perform. Then print m lines, each line should contain two integers i and j (1 ≤ i, j ≤ n), which denote assignment xi ^= xj. If there are multiple solutions yo...
standard output
PASSED
ffc18328ff7b8050b344e7b91343a3f5
train_000.jsonl
1411918500
There are some tasks which have the following structure: you are given a model, and you can do some operations, you should use these operations to achive the goal. One way to create a new task is to use the same model and same operations, but change the goal.Let's have a try. I have created the following task for Topco...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); new Task().solve...
Java
["2\n3 5\n6 0", "5\n0 0 0 0 0\n1 2 3 4 5", "3\n4 5 6\n1 2 3", "3\n1 2 3\n4 5 6"]
2 seconds
["2\n1 2\n2 2", "-1", "5\n3 1\n1 2\n2 2\n2 3\n3 1", "-1"]
NoteAssignment a ^= b denotes assignment a = a ^ b, where operation "^" is bitwise XOR of two integers.
Java 7
standard input
[ "constructive algorithms", "math", "matrices" ]
dcb55324681dd1916449570d6bc64e47
The first line contains an integer n (1 ≤ n ≤ 10000). The second line contains n integers: x1 to xn (0 ≤ xi ≤ 109). The third line contains n integers: y1 to yn (0 ≤ yi ≤ 109).
2,700
If there is no solution, output -1. If there is a solution, then in the first line output an integer m (0 ≤ m ≤ 1000000) – the number of assignments you need to perform. Then print m lines, each line should contain two integers i and j (1 ≤ i, j ≤ n), which denote assignment xi ^= xj. If there are multiple solutions yo...
standard output
PASSED
0930f6b56a69b3694e780a723aaadc51
train_000.jsonl
1411918500
There are some tasks which have the following structure: you are given a model, and you can do some operations, you should use these operations to achive the goal. One way to create a new task is to use the same model and same operations, but change the goal.Let's have a try. I have created the following task for Topco...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; /** * @author Pavel Mavrin */ public class F { private int[] s; private int k; private int[] x; private int zzz; pr...
Java
["2\n3 5\n6 0", "5\n0 0 0 0 0\n1 2 3 4 5", "3\n4 5 6\n1 2 3", "3\n1 2 3\n4 5 6"]
2 seconds
["2\n1 2\n2 2", "-1", "5\n3 1\n1 2\n2 2\n2 3\n3 1", "-1"]
NoteAssignment a ^= b denotes assignment a = a ^ b, where operation "^" is bitwise XOR of two integers.
Java 7
standard input
[ "constructive algorithms", "math", "matrices" ]
dcb55324681dd1916449570d6bc64e47
The first line contains an integer n (1 ≤ n ≤ 10000). The second line contains n integers: x1 to xn (0 ≤ xi ≤ 109). The third line contains n integers: y1 to yn (0 ≤ yi ≤ 109).
2,700
If there is no solution, output -1. If there is a solution, then in the first line output an integer m (0 ≤ m ≤ 1000000) – the number of assignments you need to perform. Then print m lines, each line should contain two integers i and j (1 ≤ i, j ≤ n), which denote assignment xi ^= xj. If there are multiple solutions yo...
standard output
PASSED
c37aeddfd3af07b95f32af8965f1aff2
train_000.jsonl
1411918500
There are some tasks which have the following structure: you are given a model, and you can do some operations, you should use these operations to achive the goal. One way to create a new task is to use the same model and same operations, but change the goal.Let's have a try. I have created the following task for Topco...
256 megabytes
import java.util.List; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Collection; import java.util.Collections; import java.io.InputStream...
Java
["2\n3 5\n6 0", "5\n0 0 0 0 0\n1 2 3 4 5", "3\n4 5 6\n1 2 3", "3\n1 2 3\n4 5 6"]
2 seconds
["2\n1 2\n2 2", "-1", "5\n3 1\n1 2\n2 2\n2 3\n3 1", "-1"]
NoteAssignment a ^= b denotes assignment a = a ^ b, where operation "^" is bitwise XOR of two integers.
Java 7
standard input
[ "constructive algorithms", "math", "matrices" ]
dcb55324681dd1916449570d6bc64e47
The first line contains an integer n (1 ≤ n ≤ 10000). The second line contains n integers: x1 to xn (0 ≤ xi ≤ 109). The third line contains n integers: y1 to yn (0 ≤ yi ≤ 109).
2,700
If there is no solution, output -1. If there is a solution, then in the first line output an integer m (0 ≤ m ≤ 1000000) – the number of assignments you need to perform. Then print m lines, each line should contain two integers i and j (1 ≤ i, j ≤ n), which denote assignment xi ^= xj. If there are multiple solutions yo...
standard output
PASSED
c33ac1fe8aedc5cdec2febfe91800788
train_000.jsonl
1411918500
There are some tasks which have the following structure: you are given a model, and you can do some operations, you should use these operations to achive the goal. One way to create a new task is to use the same model and same operations, but change the goal.Let's have a try. I have created the following task for Topco...
256 megabytes
import java.util.List; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.ArrayList; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Collection; import java.util.Collections; i...
Java
["2\n3 5\n6 0", "5\n0 0 0 0 0\n1 2 3 4 5", "3\n4 5 6\n1 2 3", "3\n1 2 3\n4 5 6"]
2 seconds
["2\n1 2\n2 2", "-1", "5\n3 1\n1 2\n2 2\n2 3\n3 1", "-1"]
NoteAssignment a ^= b denotes assignment a = a ^ b, where operation "^" is bitwise XOR of two integers.
Java 7
standard input
[ "constructive algorithms", "math", "matrices" ]
dcb55324681dd1916449570d6bc64e47
The first line contains an integer n (1 ≤ n ≤ 10000). The second line contains n integers: x1 to xn (0 ≤ xi ≤ 109). The third line contains n integers: y1 to yn (0 ≤ yi ≤ 109).
2,700
If there is no solution, output -1. If there is a solution, then in the first line output an integer m (0 ≤ m ≤ 1000000) – the number of assignments you need to perform. Then print m lines, each line should contain two integers i and j (1 ≤ i, j ≤ n), which denote assignment xi ^= xj. If there are multiple solutions yo...
standard output
PASSED
7f505c0ec7670724a6446a6e96fbfff9
train_000.jsonl
1411918500
There are some tasks which have the following structure: you are given a model, and you can do some operations, you should use these operations to achive the goal. One way to create a new task is to use the same model and same operations, but change the goal.Let's have a try. I have created the following task for Topco...
256 megabytes
import java.io.IOException; import java.util.InputMismatchException; import java.util.ArrayList; import java.io.OutputStream; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author George Marcus */ public class Main { public static void ...
Java
["2\n3 5\n6 0", "5\n0 0 0 0 0\n1 2 3 4 5", "3\n4 5 6\n1 2 3", "3\n1 2 3\n4 5 6"]
2 seconds
["2\n1 2\n2 2", "-1", "5\n3 1\n1 2\n2 2\n2 3\n3 1", "-1"]
NoteAssignment a ^= b denotes assignment a = a ^ b, where operation "^" is bitwise XOR of two integers.
Java 7
standard input
[ "constructive algorithms", "math", "matrices" ]
dcb55324681dd1916449570d6bc64e47
The first line contains an integer n (1 ≤ n ≤ 10000). The second line contains n integers: x1 to xn (0 ≤ xi ≤ 109). The third line contains n integers: y1 to yn (0 ≤ yi ≤ 109).
2,700
If there is no solution, output -1. If there is a solution, then in the first line output an integer m (0 ≤ m ≤ 1000000) – the number of assignments you need to perform. Then print m lines, each line should contain two integers i and j (1 ≤ i, j ≤ n), which denote assignment xi ^= xj. If there are multiple solutions yo...
standard output
PASSED
242a9bd48de464f8d276104a7ddc60d9
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; import java.util.Collections; public class Review4 { public static void main(String[] args) { Scanner UserInput = new Scanner(System.in); int num = UserInput.nextInt(); ArrayList<Integer> list = new ArrayList<>(num); ArrayList<Integer> sorted = new ArrayL...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
226a2434fb7912c9b7a63df4375a3352
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
256 megabytes
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class Main { public static void main (String[] args) { Scanner scanner = new Scanner (System.in); try { int size = scanner.nextInt (); Integer[] raw = new Integer[size]; Integer[] sorted = new Integer[si...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
fa15ccf36cba3b60094cde8716f77f96
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class One1 { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); in...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
fea9f91384a5040524f3ee09fad76450
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class NewClass { static final int INF = Integer.MAX_VALUE; static void mergeSort(int[] a, int p, int r) { if( p < r ) { int q = (p + r) / 2; mergeSort(a, p, q); mergeSort(a, q + 1, r)...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
f21add6b5a37fb09257043dc6c1e2c50
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
256 megabytes
import java.util.Scanner; public class HelloWorld{ public static void main(String []args){ int n,a[]; Scanner in = new Scanner(System.in); n=in.nextInt(); a=new int[n]; for(int i=0;i<n;i++)a[i]=in.nextInt(); int count=0,i1=0,i2=0,max=0,min=0,m1=0,m2=0; if(n<2){ Syste...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
977ae249bc66a48cd2c7b8020e36b8be
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
256 megabytes
import java.math.*; import java.util.*; public class BruteForce { public static Scanner in =new Scanner(System.in); /* public static String getB(int n,int l){ StringBuilder build=new StringBuilder(); while(n>0){ if(n%2==0) build.append(0); else...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
e3cd162916e50b00fa9f76d8d8b9179f
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
256 megabytes
import java.util.Scanner; public class SorttheArray451b { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[]x=new int[n]; boolean tt = true; int z=0; int b=0; for (int i = 0; i < n; i++) { x[i...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
7caa42b83fd5265410190d859287892d
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author uuu ...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
8106152794dd0928acaeebb11721ea9e
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
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 final class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here BufferedRea...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
186e1a469f3e5c9a4c26d2f945e97e21
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
256 megabytes
import java.util.*; import java.util.Scanner; import java.io.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class B451 { static class FastReader { BufferedReader br; Stri...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
216b9b87544c43d25cceabe7cea512ec
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
256 megabytes
import java.util.Scanner; public class CF451B { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] dat = new int[n]; for (int i = 0; i < dat.length; i++) { dat[i]=s.nextInt(); } if(n==1) { System.out.println("yes\n1 1"); }else { int from = -...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
0f4995ffe775cfc7baba834d0e0fef31
train_000.jsonl
1406215800
Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers.Unfortunately, the size of a is too small. You want a bigger array! Your friends agree to give you a bigger array, but only if you are able to answer the following question correctly: i...
256 megabytes
import java.util.*; public class Main { void merge(long arr[], int l, int m, int r) { // Find sizes of two subarrays to be merged int n1 = m - l + 1; int n2 = r - m; /* Create temp arrays */ long L[] = new long [n1]; long R[] = new long [n2]; /*Copy da...
Java
["3\n3 2 1", "4\n2 1 3 4", "4\n3 1 2 4", "2\n1 2"]
1 second
["yes\n1 3", "yes\n1 2", "no", "yes\n1 1"]
NoteSample 1. You can reverse the entire array to get [1, 2, 3], which is sorted.Sample 3. No segment can be reversed such that the array will be sorted.DefinitionsA segment [l, r] of array a is the sequence a[l], a[l + 1], ..., a[r].If you have an array a of size n and you reverse its segment [l, r], the array will be...
Java 8
standard input
[ "implementation", "sortings" ]
c9744e25f92bae784c3a4833c15d03f4
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the size of array a. The second line contains n distinct space-separated integers: a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109).
1,300
Print "yes" or "no" (without quotes), depending on the answer. If your answer is "yes", then also print two space-separated integers denoting start and end (start must not be greater than end) indices of the segment to be reversed. If there are multiple ways of selecting these indices, print any of them.
standard output
PASSED
f86b60f9afb5f928b12e9fde708c17b4
train_000.jsonl
1600094100
You are given an array $$$a$$$ consisting of $$$n$$$ integers. We denote the subarray $$$a[l..r]$$$ as the array $$$[a_l, a_{l + 1}, \dots, a_r]$$$ ($$$1 \le l \le r \le n$$$).A subarray is considered good if every integer that occurs in this subarray occurs there exactly thrice. For example, the array $$$[1, 2, 2, 2, ...
512 megabytes
//package ecr95; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; public class G { InputStream is; PrintWriter out; String INPUT = ""; void solve() { // 2:45 int n = ni(); int[] a = na(n); Random gen = new Rando...
Java
["9\n1 2 2 2 1 1 2 2 2", "10\n1 2 3 4 1 2 3 1 2 3", "12\n1 2 3 4 3 4 2 1 3 4 2 1"]
5 seconds
["3", "0", "1"]
null
Java 11
standard input
[ "data structures", "two pointers", "hashing", "divide and conquer" ]
fc91e26a2cae7ef51f61114e4bf428eb
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$). The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($$$1 \le a_i \le n$$$).
2,500
Print one integer — the number of good subarrays of the array $$$a$$$.
standard output
PASSED
d4805203dc0a7f53ec2b07111672bd78
train_000.jsonl
1468137600
Heidi has finally found the mythical Tree of Life – a legendary combinatorial structure which is said to contain a prophecy crucially needed to defeat the undead armies.On the surface, the Tree of Life is just a regular undirected tree well-known from computer science. This means that it is a collection of n points (ca...
256 megabytes
import java.io.*; import java.util.*; public class TreeofLife { public static void main(String args[])throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); //int m = Inte...
Java
["4\n1 2\n1 3\n1 4", "5\n1 2\n2 3\n3 4\n3 5"]
2 seconds
["3", "4"]
NoteIn the second sample, there are four lifelines: paths between vertices 1 and 3, 2 and 4, 2 and 5, and 4 and 5.
Java 11
standard input
[]
fdd50853348b6f297a62a3b729d8d4a5
The first line of the input contains a single integer n – the number of vertices in the tree (1 ≤ n ≤ 10000). The vertices are labeled with the numbers from 1 to n. Then n - 1 lines follow, each describing one edge using two space-separated numbers a b – the labels of the vertices connected by the edge (1 ≤ a &lt; b ≤ ...
1,300
Print one integer – the number of lifelines in the tree.
standard output
PASSED
5c91fbc7395f5d53d12632f6c53b0159
train_000.jsonl
1468137600
Heidi has finally found the mythical Tree of Life – a legendary combinatorial structure which is said to contain a prophecy crucially needed to defeat the undead armies.On the surface, the Tree of Life is just a regular undirected tree well-known from computer science. This means that it is a collection of n points (ca...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner in = new Scanner(System.in); int n=in.nextInt(); Vector<Integer> graph[]; graph = new Vector[110000]; for(int i=0;i<110000;++i){ graph[i]=new Vector<>(); } bo...
Java
["4\n1 2\n1 3\n1 4", "5\n1 2\n2 3\n3 4\n3 5"]
2 seconds
["3", "4"]
NoteIn the second sample, there are four lifelines: paths between vertices 1 and 3, 2 and 4, 2 and 5, and 4 and 5.
Java 11
standard input
[]
fdd50853348b6f297a62a3b729d8d4a5
The first line of the input contains a single integer n – the number of vertices in the tree (1 ≤ n ≤ 10000). The vertices are labeled with the numbers from 1 to n. Then n - 1 lines follow, each describing one edge using two space-separated numbers a b – the labels of the vertices connected by the edge (1 ≤ a &lt; b ≤ ...
1,300
Print one integer – the number of lifelines in the tree.
standard output
PASSED
071ec6a480ff06d632363e5b520b1982
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); ArrayList<String[]> a = new ArrayList<>(); for(int i=0; i<t; i++) { int n = sc.nextInt(); String[] s = new String[n]; for(int j=0; j<n; j++) s[j] = sc.ne...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
3a508d60613bd5f8c5272aec91649c0f
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); ArrayList<String[]> a = new ArrayList<>(); for(int i=0; i<t; i++) { int n = sc.nextInt(); String[] s = new String[n]; for(int j=0; j<n; j++) s[j] = sc.ne...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
bfadce30097e58355bfe010314746d34
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.util.*; public class JugglingLetters { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t-- > 0) { int n = scanner.nextInt(); scanner.nextLine(); int letters[] = new int[26]; boolean cando = true; for (int l = 0; ...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
f948ffda64b5d596f2993185cae6d40d
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
//package com.cf.r666; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; p...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
56c1150ca5e473a44224697ae5b013a2
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.util.Scanner; public class JugglingLetters { public static void main(String[] args) { Scanner entrada = new Scanner(System.in); int numero, diferente, m = 1; numero = entrada.nextInt(); for (int i = 0; i < numero; i++) { int n = entrada.nextInt(); ...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
3f54e3ccf08ff078246ebea3025e8b8a
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class test { public static void main(String args[]) { try{ Scanner sc= new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int a[] = new int[256]; boolean check = true; ...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
37b1a4d0091a4e763bb50089b3b10eaf
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.text.DecimalFormat; import java.util.stream.LongStream; import java.util.stream.IntStream; import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
d4e25c838cf0214c05bbc8280394443b
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.text.DecimalFormat; import java.util.stream.LongStream; import java.util.stream.IntStream; import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
e2cfd1e99d857e887deed427b500d2ba
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.io.*; // for handling input/output import java.util.*; // contains Collections framework public class Solution { public static void main (String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t-->0){ int n = in.nextInt(); Map<Charac...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
291f6956662fb7586d1925177e34f805
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class CF_A_1397 { public static void main(String[] args) throws IOException { long t = readLong(); TestLoop: for (int __ = 0; __ < t; __++) { long ...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
e25b49b18ea26ff61225a581742359a0
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
//Codeforces 1397A import java.util.Scanner; public class CF1397A { static final Scanner SC = new Scanner(System.in); public static void main(String[] args) { int tests = SC.nextInt(); for (int t = 0; t < tests; ++t) { int numStrings = SC.nextInt(); String[] strings = n...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
44a5cd30bc6fc78222e96a3661897ff4
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int[] arr = new int[30]; for (int j = 0; j < n; j++) { ...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
21906a1eff54dd18c4f095a24e50f49a
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.util.*; import java.io.*; public class juggling { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int t = Integer.parseInt(in.readLine()); for(int i = 0; i < t; i++) {...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
35639e7506aead5dc44ed35aa7993361
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.util.Scanner; public class Codeforcse { public static void main(String[] args) { Scanner o=new Scanner(System.in); int t=o.nextInt(); while(t>0) { int n=o.nextInt(); int ar[]=new int[26]; boolean done=false; for(int i=0;i<n;i++) { String s=o.next(); for(int j=0;j<s.length();j++) { ...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
f3cc6101a3df4048b3035c8e8b28841d
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static class Reader { static BufferedReader reader; static StringTokenizer tokenizer; /** call this method to initialize reader for InputStream */ static void init(InputStream input) { reader = new BufferedReader( ...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
952bef3f0a3077b893bc2e37d6025258
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; public class Cf131 implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCh...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
16241c768fa28bb1c7c8001059bb40b0
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.util.*; public class Main{ // public static public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); String[] arr= new String[n]; for(int i=0;i<n;i++){ arr[i]=sc.next(); } HashMap<Character,Integer> map= ...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output
PASSED
a3f060bc5a08166337fbb5584619e36b
train_000.jsonl
1598798100
You are given $$$n$$$ strings $$$s_1, s_2, \ldots, s_n$$$ consisting of lowercase Latin letters.In one operation you can remove a character from a string $$$s_i$$$ and insert it to an arbitrary position in a string $$$s_j$$$ ($$$j$$$ may be equal to $$$i$$$). You may perform this operation any number of times. Is it po...
256 megabytes
import java.util.Scanner; public class juggling { public static void main(String[] args) { int t; Scanner scan = new Scanner(System.in); t = scan.nextInt(); while (t--!=0) { int n = scan.nextInt(); int[] arr = new int[26]; for (int ...
Java
["4\n2\ncaa\ncbb\n3\ncba\ncba\ncbb\n4\nccab\ncbac\nbca\nacbcc\n4\nacb\ncaf\nc\ncbafc"]
1 second
["YES\nNO\nYES\nNO"]
NoteIn the first test case, you can do the following: Remove the third character of the first string and insert it after the second character of the second string, making the two strings "ca" and "cbab" respectively. Remove the second character of the second string and insert it after the second character of the firs...
Java 11
standard input
[ "greedy", "strings" ]
3d6cd0a82513bc2119c9af3d1243846f
The first line contains $$$t$$$ ($$$1 \le t \le 10$$$): the number of test cases. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$): the number of strings. $$$n$$$ lines follow, the $$$i$$$-th line contains $$$s_i$$$ ($$$1 \le \lvert s_i \rvert \le 1000$$$). The sum of lengths ...
800
If it is possible to make the strings equal, print "YES" (without quotes). Otherwise, print "NO" (without quotes). You can output each character in either lowercase or uppercase.
standard output