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
82eaa2e74d465ce80e9d41d063d0a838
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.io.*; import java.util.*; public class noob{ InputReader in; final long mod=1000000007; StringBuilder sb; public static void main(String[] args) throws java.lang.Exception{ new noob().run(); } void run() throws Exception { in=new InputReader(System.in); sb = n...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
c15d8aafe9c562cd16da0037c21c2523
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; public class Sample { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); for(int i = 0; i < t; ++i) { int n = input.nextInt(); int m = input.nextInt(); int population[] = new int[n]; for(int...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
04d38b37c65ba6161eed7fe56f637247
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.io.*; import java.sql.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class c { public static void print(String str,long val){ System.out.println(str+" "+val); } public long gcd(long a, long b) { i...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
7e9221e5a56437a6114034072c1daacb
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.*; import java.io.*; import java.lang.Math; public class C{ static List<Integer>[] adjList; static boolean[] visited; static int[] people; static int[] hIndex; static int[] cp; public static void main(String[] args) throws Exception{ FastScanner fs = new FastScanner(); int t = fs.nextInt(...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
1246bf51a717df6e5e40086f4c36ddf9
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.*; public class countryMood{ static int n, m; static List<List<Integer>> graph; static long[] pop, moods, commuters, good; static boolean possible = true; public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); w...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
aa0bea417c991d3874e1b73c34aa8192
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.io.*; import java.util.*; /** * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools */ public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
3419d3a432b7d1770893a23f955c6928
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import static java.util.Collections.*; import static java.lang.Math.*; @SuppressWarnings("unchecked") public class C_Uncle_Bogdan_and_Country_Happiness { public static PrintWriter out; public static InputReader in; public static long[] p...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
fe91fd568ccb7ef6842939f649d21a1c
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.math.*; import java.io.*; import java.util.*; import java.awt.*; public class Main implements Runnable { @Override public void run() { try { new Solver().solve(); System.exit(0); } catch (Exception | Error e) { e.printStackTrace(); Sys...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
c1a07a5d6af7e40fd92e7bbe9cc260e3
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.*; import java.io.*; public class happiness { 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
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
6c02160ddcf5454aea5c10506899f703
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.awt.Point; // U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE................ // ASCII = 48 + i ;// 2^28 = 268,435,456 > 2* 10^8 // log 10 base 2 = 3.3219 // odd:: (x^2+1)/2 , (x^2-1)/2 ; x>=3// even:: (x^2/4)+1 ,(x^2/4)-1 x >=4...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
d2d168257bdcbc3f31e98c1294a18ae4
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.*; import java.io.*; public class div { static StringBuilder ans; static int[] pi,hi; static ArrayList<ArrayList<Integer>> g; public static void main(String[] args) throws IOException { ans = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamRea...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
ae3240ad2215d37776b3685b43b8aed5
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.*; import java.io.*; public class div { static StringBuilder ans; static int[] pi,hi; static ArrayList<ArrayList<Integer>> g; public static void main(String[] args) throws IOException { ans = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStrea...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
766511e1ba3fa6d8b9ff09f2b1200105
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.io.*; import java.util.*; public class CF1388C extends PrintWriter { CF1388C() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1388C o = new CF1388C(); o.main(); o.flush(); } int[] oo; int[][] oj; void link(int i, int j) { int o = oo[i]; if (...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
9155499643770def78f3d00733490f9e
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.io.*; import java.util.ArrayDeque; import java.util.Arrays; import java.util.StringJoiner; import java.util.StringTokenizer; public class MainC { public static void main(String[] args) { var sc = new FastScanner(System.in); var pw = new PrintWriter(System.out); var T = sc.nextI...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
5bbd2eb7d8a9ad526ff404887e3f9a19
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.*; import java.io.*; public class C { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int nTest = scanner.nextInt(); for(int iTest = 1; iTest <= nTest; iTest++) { int n = scanner.nextInt()...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
fd672ea754eb97854c2dff6779b6ff3c
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.*; import java.io.*; import java.lang.Math; public class C { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int nTest = scanner.nextInt(); for(int iTest = 1; iTest <= nTest; iTest++) { ...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
9e142a8b4d9ca97f72a6f9b57a06087f
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.*; import java.io.*; public class e{ static int flag=0; static void dfs_visited(int curr,int[] v,int[] good,int[] h,int[] population,int[] total,int[] parent, ArrayList<ArrayList<Integer>> graph){ int good_people=0; int total_visited=population[curr]; for (int i=0;i<graph.get(curr).size();i...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
31d0f3273f909e0fc5c690c315079b49
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.*; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; public class Solution { static ArrayList<Integer> tree[]; static int live[],happy[],pass[],h[],s[],f; static int dfs(int u, int p){ int count=0; for(int v:tree[u]){ if(v!=p)...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
87eaee35cf12c70e613c97fb0d4f5cf7
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; /* problem: C * author: ShifaYang * date: 2020-08-03 06:03:46 * solve: */ public class Main { static Scanner sc = new Scanner(System.in); static final int N = (int) 2e5 + 10; static class Node { ArrayList<Integer> sons = new ArrayList<Integer>(); int...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
4644b14681c3a5f7d2d388e333cccef9
train_000.jsonl
1440865800
Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars.Each player can double his bid any number of times and triple his bid any number of ti...
256 megabytes
/** * Created by kapilkrishnakumar on 11/4/15. * http://codeforces.com/problemset/problem/573/A */ import java.util.*; public class BearPoker { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] lowest = new int[n]; for(int ...
Java
["4\n75 150 75 50", "3\n100 150 250"]
2 seconds
["Yes", "No"]
NoteIn the first sample test first and third players should double their bids twice, second player should double his bid once and fourth player should both double and triple his bid.It can be shown that in the second sample test there is no way to make all bids equal.
Java 7
standard input
[ "implementation", "number theory", "math" ]
2bb893703cbffe9aeaa0bed02f42a05c
First line of input contains an integer n (2 ≤ n ≤ 105), the number of players. The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 109) — the bids of players.
1,300
Print "Yes" (without the quotes) if players can make their bids become equal, or "No" otherwise.
standard output
PASSED
64e051ee258c1438ec4cfd529bf1c572
train_000.jsonl
1440865800
Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars.Each player can double his bid any number of times and triple his bid any number of ti...
256 megabytes
import java.io.*; import java.util.*; import java.util.List; public class Main { private static StringTokenizer st; private static BufferedReader br; public static long MOD = 1000000007; private static double EPS = 0.0000001; public static void print(Object x) { System.out.println(x + "");...
Java
["4\n75 150 75 50", "3\n100 150 250"]
2 seconds
["Yes", "No"]
NoteIn the first sample test first and third players should double their bids twice, second player should double his bid once and fourth player should both double and triple his bid.It can be shown that in the second sample test there is no way to make all bids equal.
Java 7
standard input
[ "implementation", "number theory", "math" ]
2bb893703cbffe9aeaa0bed02f42a05c
First line of input contains an integer n (2 ≤ n ≤ 105), the number of players. The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 109) — the bids of players.
1,300
Print "Yes" (without the quotes) if players can make their bids become equal, or "No" otherwise.
standard output
PASSED
37b98bc60140be57fb656f332914f281
train_000.jsonl
1440865800
Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars.Each player can double his bid any number of times and triple his bid any number of ti...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.List; public class B { static String NO = "No"; static String YES = "Yes"; public static void main(String[] args) throws Exception { readIntArray(); ...
Java
["4\n75 150 75 50", "3\n100 150 250"]
2 seconds
["Yes", "No"]
NoteIn the first sample test first and third players should double their bids twice, second player should double his bid once and fourth player should both double and triple his bid.It can be shown that in the second sample test there is no way to make all bids equal.
Java 7
standard input
[ "implementation", "number theory", "math" ]
2bb893703cbffe9aeaa0bed02f42a05c
First line of input contains an integer n (2 ≤ n ≤ 105), the number of players. The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 109) — the bids of players.
1,300
Print "Yes" (without the quotes) if players can make their bids become equal, or "No" otherwise.
standard output
PASSED
70794f7308e116d9876dc45d1215186f
train_000.jsonl
1440865800
Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars.Each player can double his bid any number of times and triple his bid any number of ti...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["4\n75 150 75 50", "3\n100 150 250"]
2 seconds
["Yes", "No"]
NoteIn the first sample test first and third players should double their bids twice, second player should double his bid once and fourth player should both double and triple his bid.It can be shown that in the second sample test there is no way to make all bids equal.
Java 7
standard input
[ "implementation", "number theory", "math" ]
2bb893703cbffe9aeaa0bed02f42a05c
First line of input contains an integer n (2 ≤ n ≤ 105), the number of players. The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 109) — the bids of players.
1,300
Print "Yes" (without the quotes) if players can make their bids become equal, or "No" otherwise.
standard output
PASSED
6a735f21dbabd0f86eb15460309289b1
train_000.jsonl
1440865800
Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars.Each player can double his bid any number of times and triple his bid any number of ti...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.StringTokenizer; public class Main { static class Reader...
Java
["4\n75 150 75 50", "3\n100 150 250"]
2 seconds
["Yes", "No"]
NoteIn the first sample test first and third players should double their bids twice, second player should double his bid once and fourth player should both double and triple his bid.It can be shown that in the second sample test there is no way to make all bids equal.
Java 7
standard input
[ "implementation", "number theory", "math" ]
2bb893703cbffe9aeaa0bed02f42a05c
First line of input contains an integer n (2 ≤ n ≤ 105), the number of players. The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 109) — the bids of players.
1,300
Print "Yes" (without the quotes) if players can make their bids become equal, or "No" otherwise.
standard output
PASSED
d9d3a4986e17c882ad1492497d514bd4
train_000.jsonl
1440865800
Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are n players (including Limak himself) and right now all of them have bids on the table. i-th of them has bid with size ai dollars.Each player can double his bid any number of times and triple his bid any number of ti...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.HashSet; import java.util.InputMismatchException; public class Main { class MyScanner { private byte[] buf = new byte[1024]; private int curChar; private int numChars; BufferedInputStream...
Java
["4\n75 150 75 50", "3\n100 150 250"]
2 seconds
["Yes", "No"]
NoteIn the first sample test first and third players should double their bids twice, second player should double his bid once and fourth player should both double and triple his bid.It can be shown that in the second sample test there is no way to make all bids equal.
Java 7
standard input
[ "implementation", "number theory", "math" ]
2bb893703cbffe9aeaa0bed02f42a05c
First line of input contains an integer n (2 ≤ n ≤ 105), the number of players. The second line contains n integer numbers a1, a2, ..., an (1 ≤ ai ≤ 109) — the bids of players.
1,300
Print "Yes" (without the quotes) if players can make their bids become equal, or "No" otherwise.
standard output
PASSED
31ad8c0d4f040e00141c23d5e42b381d
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int t = s.nextInt(); while (t --> 0) { int n = s.nextInt(); int[] a = new int[n]; int[] b ...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
98ed9d1441d6a9c6580a3f09b2218102
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; public class Main { static PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int a[]=sc.next...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
4836bd7e9d80b034eda80ed14510bf32
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { //System.out.println("GfG!"); int t, n, a[][]; Scanner sc = new Scanner(System.in); t = sc.nextInt(); while(t-- != 0){ n = sc.nextInt(); a = n...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
2c3ab007060866eec4575b72ec00344b
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
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 SolA { public static void main(String[] args) throws java.lang.Exception { // your code goes here Reader sc = new Reader(); PrintWriter out = new Pri...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
6ce3f9a359aed0ccb176bed5b6fa5314
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.util.*; public class Problem_A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int a[][] = new int[3][n]; for(int i = 0; i < 3; i++) { ...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
c5945d11febb719e5f4e6bff6eaa57d9
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.util.*; public class A1 { public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t>0) { int n=s.nextInt(); int ans[]=new int[n]; int a[]=new int[n]; int b[]=new int[n]; int c[]=new int[n]; for(int i=0;i<n;i++) { a[i]=s.nextIn...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
f1c39fa9e9a0a67c3435d8e7c1fb55d6
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.util.Scanner; public class p1408A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); for (int t = sc.nextInt(); t-- > 0;) { int n = sc.nextInt(), a[][] = new int[3][n]; for (int i = 0; i < 3; i++) for (int j = 0; j < n; j++) a[i][j] = sc.nextInt(); int i ...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
85f71c4d267b7c5ca011f7ab68d9aa2b
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.util.Scanner; public class p1408A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); for (int t = sc.nextInt(); t-- > 0;) { int n = sc.nextInt(), a[][] = new int[3][n]; for (int i = 0; i < 3; i++) for (int j = 0; j < n; j++) a[i][j] = sc.nextInt(); int i=...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
a9da7478d930d83306ebdfef950b581c
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
//package MyJavaProject; import java.util.*; import java.lang.Math; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.io.*; import java.math.BigInteger; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; ...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
744ffc50ccf21ccee25fb24894cda958
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
/** * https://codeforces.com/contest/1408/problem/A */ import java.util.*; import java.io.*; public class CircleColoring { public static BufferedReader in; public static PrintWriter out; public static StringBuilder sol; public static Utilities util; public static void main(String[] args) throws IOException {...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
62c2724668ca99864cd14211beb9e3ec
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Scanner; import java.util.*; //FuCk ThE RaTiNgS. //YoU NeVeR LoSe EiThEr YoU LeArN Or YoU WiN. public class A { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buf...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
240cfb992bd7faa62cd419562eb43576
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.io.*; import java.util.*; /* polyakoff */ public class Main { static FastReader in; static PrintWriter out; static Random rand = new Random(); static final int oo = (int) 1e9 + 10; static final long OO = (long) 2e18 + 20; static final int MOD = (int) 1e9 + 7; static void solv...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
7a6268a36c1dcf71395ddfe2cf0340c5
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.io.*; import java.util.*; /* polyakoff */ public class Main { static FastReader in; static PrintWriter out; static Random rand = new Random(); static final int oo = (int) 1e9 + 10; static final long OO = (long) 2e18 + 20; static final int MOD = (int) 1e9 + 7; static void sol...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
06a2aa036fe89d8f2e48f2a98cebfb6d
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class FibinacciSeries { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() ...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
977fdf1f12805032727b622e6f5d8bc7
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.util.*; import java.util.stream.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); StringBuilder result = new StringBuilder(); int t = scan.nextInt(); int j; for(int i = 0; i < t; i++) { int n = scan.nextInt(); int[] a = new ...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
01fa32a956b988193e1915e27a3caf1f
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.util.*; import java.io.*; public class Prb64 { static FastReader sc = new FastReader(); public static void main(String[] args) { int t = sc.nextInt(); while(t-- != 0 ){ int n = sc.nextInt(); int a[] = new int[n]; ...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
ce361d1b41ab757f05677b0f00c94d3e
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int arr1[]= new int[n]; int arr2[]=new int[n]; int arr3[]=new int[n]; ...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
6677ba198fb30aea8f3499008c431c28
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class A { //-----------Integer Array Input---------- static int[] readIntArray(int n){ int arr[]=new int[n]; for(int i=0;i<n;i++) arr[i]=scan.nextInt(); return arr; } //-----------Long Array Input-...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
a4878aa7b458e0a577889fca60987710
train_000.jsonl
1601476500
You are given three sequences: $$$a_1, a_2, \ldots, a_n$$$; $$$b_1, b_2, \ldots, b_n$$$; $$$c_1, c_2, \ldots, c_n$$$.For each $$$i$$$, $$$a_i \neq b_i$$$, $$$a_i \neq c_i$$$, $$$b_i \neq c_i$$$.Find a sequence $$$p_1, p_2, \ldots, p_n$$$, that satisfy the following conditions: $$$p_i \in \{a_i, b_i, c_i\}$$$ $$$p_i \ne...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) throws Exceptio...
Java
["5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3"]
1 second
["1 2 3\n1 2 1 2\n1 3 4 3 2 4 2\n1 3 2\n1 2 3 1 2 3 1 2 3 2"]
NoteIn the first test case $$$p = [1, 2, 3]$$$.It is a correct answer, because: $$$p_1 = 1 = a_1$$$, $$$p_2 = 2 = b_2$$$, $$$p_3 = 3 = c_3$$$ $$$p_1 \neq p_2 $$$, $$$p_2 \neq p_3 $$$, $$$p_3 \neq p_1$$$ All possible correct answers to this test case are: $$$[1, 2, 3]$$$, $$$[1, 3, 2]$$$, $$$[2, 1, 3]$$$, $$$[2, 3, 1]...
Java 8
standard input
[ "constructive algorithms" ]
7647528166b72c780d332ef4ff28cb86
The first line of input contains one integer $$$t$$$ ($$$1 \leq t \leq 100$$$): the number of test cases. The first line of each test case contains one integer $$$n$$$ ($$$3 \leq n \leq 100$$$): the number of elements in the given sequences. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \l...
800
For each test case, print $$$n$$$ integers: $$$p_1, p_2, \ldots, p_n$$$ ($$$p_i \in \{a_i, b_i, c_i\}$$$, $$$p_i \neq p_{i \mod n + 1}$$$). If there are several solutions, you can print any.
standard output
PASSED
ccfeaa12edd46e93049541c67ad99e42
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.*; import java.util.HashSet; import java.util.Iterator; /** * Created by Scruel on 2017/5/10. * Personal blog : http://blog.csdn.net/scruelt * Github : https://github.com/scruel * //TODO */ public class CF746E { static BufferedWriter bfw = new BufferedWriter(new OutputStreamWriter(System.o...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
7d6999a351c7f30ff2233df07362dbf9
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.*; import java.util.*; public class E { FastScanner in; PrintWriter out; int i = 0, j = 0; void solve() { /**************START**************/ int n = in.nextInt(), m = in.nextInt(); int[] nums = new int[n]; TreeSet<Integer> evens = new TreeSet<Integer>(); TreeSet<Integer> odds = new Tre...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
b88d9a41eab50f006c86d64824e2681b
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; /** * Created by Firеfly on 12/18/2016. */ public class code { public static void main(String[] args) throws IOException { Woorker worker = new Woorker(); } } ...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
1025e384993a325e73ab329a51a8b22e
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.LinkedList; import java.util.StringTokenizer; import java.util.TreeSet; public class P746E { public static void main(String[] args) { FastScanner scan = new FastScanner(); Print...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
cf243f6ba66b70c2f05519cffdd46bfc
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashSet; import java.util.InputMismatchException; public class E { public static void main(String[] args) { FastScannerE sc = new FastScannerE(System.in); int N = sc.nextInt(); int NH = N/2; int M = sc.nex...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
384c4fc9e397d9a5063d4747ee291ff8
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.*; import java.util.*; public class A558 { static BufferedReader in = null; static PrintWriter out = null; static StringTokenizer st = new StringTokenizer(""); public static void main(String[] args) { try { in = new BufferedReader(new InputStreamReader(System.in)); out = new Pri...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
2fee02dc8d3cc035ffdf0814f954f035
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.*; import java.util.*; public class A558 { static BufferedReader in = null; static PrintWriter out = null; static StringTokenizer st = new StringTokenizer(""); public static void main(String[] args) { try { in = new BufferedReader(new InputStreamReader(System.in)); out = new Pri...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
0853c3e47965c0bd9c9ef31c28be6336
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.*; import static java.lang.Math.abs; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Long.parseLong; import s...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
b7530aa2ace0bef77defbd921973c0a3
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
2147466e1b22b3c6defd91ea1c2ad82d
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.util.*; import java.io.*; public class NumbersExchange { /************************ SOLUTION STARTS HERE ***********************/ private static void solve(FastScanner s1, PrintWriter out){ int N = s1.nextInt(); int M = s1.nextInt(); int arr[] = s1.nextIntArray(N); HashSet<Integer> even...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
00afd21b2d2bc0126c6e85bffbf63df5
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
//package taz; import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; impor...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
03f4094c86a0f2b7917a1c490f0187a4
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
// package codeforces.cf3xx.cf386.div2; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; public class E { public static void main(String[] args) { InputReade...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
8f74e6b715c6db234f641b691f9c5091
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelpe...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
e2b4329382863fa218c126f2c61ef988
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.PrintStream; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; impo...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
e3bd8a0c66bb5f2f34f8a4aadf2bfe7c
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFi...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
d48e2f11f4976272fc776f6b387c7208
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.util.*; import java.io.*; public class E { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] L = br.readLine().split(" "); int N = Integer.parseInt(L[0]); int M = Integer.parseInt(L[1]); int eS = 2; int...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
316ed5678cba18db53cb02515a550624
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class c386E { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); Card[] cards = new Card[n]; Card[] sort = new Card[n]; int odd = 0; HashSet<Integer> used = new HashS...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
f1c6ac2615c046618ec4eb5c6a9d2e35
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.*; import java.util.*; public class E { public static void main(String[] args) throws Exception { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); String[] split = f.readLine().split("\\s+"); int n = Integer.parseInt(spl...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
e55a281b2640a74949a39a0bd427f1db
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchException; import java.util.TreeMap; import java.util.TreeSet; public class Q1 { static long MOD = 1000000007; stati...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
21a3a411e671cc6ab9deab4b6eb857ff
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.*; import java.util.*; public final class round_386_e { static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static FastScanner sc=new FastScanner(br); static PrintWriter out=new PrintWriter(System.out); static Random rnd=new Random(); static ArrayDeque<Node>[] al1,al...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
cbbbd9ebb7ba90326437bcd151c407ac
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Random; import java.io.OutputStreamWriter; import java.util.NoSuchElementException; import java.io.OutputStream; import java.io.PrintWriter; import java...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
34d48ff88dbb21cc0cc670849fd81dc2
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.Tre...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
46b3937fb30f2a0a3eec5bf1c59a6570
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.*; import java.util.*; public class c{ static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { int n = ni(); int m = ni(); TreeSet<Integer> set = new TreeSet<>(); int odd = 0, even = 0; int[] a = new int[n]; for(int i = 0; i < n; ++i) { ...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
c5beb5612d0e957a24065238219172eb
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.HashSet; import java.util.StringTokenizer; public class Di...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
805d2f761271b7c7299af74ad2272c44
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; /** * Created by nitin.s on 18/12/16. */ public class NumbersExchange { public static void main(String[] args) throws IOException { FastScann...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
38c5627b99e85debbf184e38aacdc08a
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.io.*; import java.util.*; /** * Created by user on 18.02.2017. */ public class Task746E { private int m; private List<Card> initCards =new ArrayList<>(); private int n; private Set<Integer> uniqueNumbers=new HashSet<>(); private int oddCount=0; private int evenCount=0; ...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
e7a9c0c72177e542f372d191194689f0
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; import java.text.DecimalFormat; import java.math.BigInteger; public class Main{ //static int d=20; static long mod=1000000007 ; static HashMap<String,Double> hm=new HashMap<>(); static ArrayList<ArrayList<Int...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
2548f7aa40d1e3591ec4401c05da8c19
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
/* * Code Author: Akshay Miterani * DA-IICT */ import java.io.*; import java.math.BigInteger; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.*; public class Main { static double eps=(double)1e-6; static long mod=(int)1e9+7; private static final long INF = 1000000000_000000L; pub...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
38fc20706afb5ce1a5415f6feb85e868
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
/* * Code Author: Akshay Miterani * DA-IICT */ import java.io.*; import java.math.BigInteger; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.*; public class Main { static double eps=(double)1e-6; static long mod=(int)1e9+7; private static final long INF = 1000000000_000000L; pub...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
158aa9cfbfc04dd4d6fe9d2feb69e326
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } long mod=1000000007; long gcd(long a,long b) { return b==0?a:gcd(b,a%b);...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
d718c074ea907c140786e4876b74ec43
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } long mod=1000000007; long gcd(long a,long b) { return b==0?a:gcd(b,a%b);...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
6541423a485d4107fc9f358abf6e720d
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] pts = br.readLine().split(" "); int n = Integer.parseInt(pts[0]); int m...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
c20462f6ca7c4754c30939e44589c303
train_000.jsonl
1482057300
Eugeny has n cards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of odd integers, and that all these numbers would be distinct. Nikolay has m cards, distinct numbers from 1 to m are written on...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] pts = br.readLine().split(" "); int n = Integer.parseInt(pts[0]); int m...
Java
["6 2\n5 6 7 9 4 5", "8 6\n7 7 7 7 8 8 8 8", "4 1\n4 2 1 10"]
1 second
["1\n5 6 7 9 4 2", "6\n7 2 4 6 8 1 3 5", "-1"]
null
Java 8
standard input
[ "implementation", "greedy", "math" ]
86bf9688b92ced5238009eefd051387d
The first line contains two integers n and m (2 ≤ n ≤ 2·105, 1 ≤ m ≤ 109) — the number of cards Eugeny has and the number of cards Nikolay has. It is guaranteed that n is even. The second line contains a sequence of n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the numbers on Eugeny's cards.
1,900
If there is no answer, print -1. Otherwise, in the first line print the minimum number of exchanges. In the second line print n integers — Eugeny's cards after all the exchanges with Nikolay. The order of cards should coincide with the card's order in the input data. If the i-th card wasn't exchanged then the i-th numb...
standard output
PASSED
cf42093e45d008beb55949ba9ab37270
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Scanner; public class aa { public static void main(String[] args)throws NumberFormatException, IOException { //Scanner in=new Scanner(Syst...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
4d49b73a340484c906520c26598cbfaa
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; public class SerejaAndArray { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamRead...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
af2fada83af1e6cbb319c34fbc30e392
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.*; public class Main { public static void main(String args[]) throws IOException { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); String line = stdin.readLine(); String[] prms = line.split(" "); int n = Integer.parseInt(prms[0]); int m = Integer.p...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
21877dd65ffd8d526faafcb3e81e0c87
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.InputMismatchException; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { ...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
71a38f07d1786360f0a218df676d9fff
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; import java.io.*; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[]...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
6c5688d2723083e299636e7a103d63dc
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; public class B { public static void main(String[] args)throws IOException { StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); st.nextToken()...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
feee5d8956de69cd9bfd3added691376
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; public class B { public static void main(String[] args) throws Exception{ InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
0be4cdc7b1c98f69702c405341131b9d
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.io.Writer; import java.math.BigInteger; import...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
726da2bf29cbfc1aea7b9cda84d2ea72
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.util.*; import java.io.*; public class B { Scanner sc = new Scanner(System.in); void doIt() { int n = Integer.parseInt(sc.next()); int m = Integer.parseInt(sc.next()); long [] a = new long[n+1]; int [] w = new int[n+1]; for(int i = 1; i <= n; i++) { a[i] = Long.parseLong(sc.next()); w[i] ...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
112efb76cb47256d2c03921974a5044f
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.util.*; import java.io.*; public class B { Scanner sc = new Scanner(System.in); void doIt() { int n = sc.nextInt(); int m = sc.nextInt(); long [] a = new long[n+1]; int [] w = new int[n+1]; for(int i = 1; i <= n; i++) { a[i] = sc.nextLong(); w[i] = 0; } int old = 0; long cur_v = 0; ...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
1dc361cfe1163f53f74f63018974e99f
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import com.sun.corba.se.spi.orb.OperationFactory; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; /** * * @author Robert Nabil */ public class Array { public static void main(String[] args) throws Exception{ BufferedReader sc = new BufferedReader(new InputStr...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
b5c668b9f46fc650793820031d84d5ae
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; i...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
e2a933c3fa8d4af4a1a6de8c65099a1a
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.math.BigDecimal; import java.io.BufferedWriter; import java.util.Locale; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputSt...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
5871ad7f0ca1d31de0d63739e5f30443
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ //package pkg188; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; /** * * @author Alik */ public class F { static String line; static int cur = 0; public static...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
a0b491ebc88a4231540808ca3ad3df85
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
//import java.util.*; //Scanner; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; //PrintWriter public class R187_Div2_B { public static void main(String[] args) throws IOException { //Scanner in = new Scanner(System.in); BufferedReade...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
d67fc7addca9a7fdc9c31c53c786b171
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
//import java.util.*; //Scanner; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; //PrintWriter public class R187_Div2_B { public static void main(String[] args) throws IOException { //Scanner in = new Scanner(System.in); BufferedReade...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
04257769bc638372de3c9da04102385e
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; public class R187_Div2_B_fr { public static void main(String[] args) { InputStream inputStream = System...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
4ae8f3491ddab15d90116840eba0a71a
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.*; //PrintWriter import java.math.*; //BigInteger, BigDecimal import java.util.*; //StringTokenizer, ArrayList public class R187_Div2_B { FastReader in; PrintWriter out; public static void main(String[] args) { new R187_Div2_B().run(); } void run() { in = new FastReader(System.in...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
7b9b7d7f9c286c024c61ddc170fce438
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class Main { public static void main(String[] args) { //Scanner sc=new Scanner(System.in); BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); String[] nm={"0","0"}; ...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
0d8fc3afa22220cbad8c479999c61fd1
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String line = input.readLine(); int n ...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
507ecce1feb304e53ea5a279bd9fa6ea
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { private static StringTokenizer tokenizer; private static BufferedReader bf...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
d4e3f1a0d1238de7538b0b79d0bc9672
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class B { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(System.out); BufferedReader br = new BufferedReader(new ...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output
PASSED
495e7591338b34f3924c5fe47043f6ef
train_000.jsonl
1370619000
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms: Make vi-th array element equal to xi. In other words, perform the assignment avi = xi. Increase each array element by yi. In other ...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader( System.in )); //Scanner sn = new Scanner(System.in); String[] in = null; try { in = br.readLine().split(" "); } catch (IOException e) { ...
Java
["10 11\n1 2 3 4 5 6 7 8 9 10\n3 2\n3 9\n2 10\n3 1\n3 10\n1 1 10\n2 10\n2 10\n3 1\n3 10\n3 9"]
1 second
["2\n9\n11\n20\n30\n40\n39"]
null
Java 7
standard input
[ "implementation" ]
48f3ff32a11770f3b168d6e15c0df813
The first line contains integers n, m (1 ≤ n, m ≤ 105). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the original array. Next m lines describe operations, the i-th line describes the i-th operation. The first number in the i-th line is integer ti (1 ≤ ti ≤ 3) that represents the ...
1,200
For each third type operation print value aqi. Print the values in the order, in which the corresponding queries follow in the input.
standard output