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
d54cfcbeddea9898307be648c6f20e0f
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
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 CC { static StringTokenizer st; static BufferedReader br; static PrintW...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
914389213eb26fed8297618982e1f44b
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Locale; import java.util.Scanner; import java.util.TreeSet; /** * * @author таня */ public class KF { /** * @param args the command line arguments */ public static void ma...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
1d7c376ee4a7a86c5255a1a809b4b9d3
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.InputStream; import java.util.NoSuchElementException; import java.io.OutputStreamWriter; import java.math.BigInteger; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; /** *...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
4ab6811dc482cd6d97fc687da1ef2c39
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.*; import java.io.*; public class KnightTemplar { public static void main(String [] args)throws Exception{ BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); String s=bf.readLine(); String t=bf.readLine(); int leftPtr=0; int rightPtr=0; int ptr=0; for(int i=0;i<t.length() &&...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
65c230066cb39665c155785e1b689123
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.lang.*; import java.io.*; import java.util.*; public class CF{ public static boolean isSubstring(String a, String b){ //runs in O(|B| + |A| time) //checks if a is substring of b int i1 = 0; for (int i = 0; i < b.length(); i++){ if (a.charAt(i1) == b.charAt(i)){ i1...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
35544cdb702dd8494fc0b655522cb66a
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.StringTokenizer; import...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
231170e70598fbe9e8d972ab3f1f125b
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.*; import java.util.*; public class Solution { StringTokenizer st; BufferedReader in; PrintWriter out; void solve() throws IOException { //in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt"), "ISO-8859-1")); //out = new PrintWriter(new OutputSt...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
acc86b520fb93b8bb3f510f6b76208b7
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.*; import java.io.*; public class c { public static void main(String[] args) throws IOException { input.init(System.in); String s = input.next(), t = input.next(); int a = first(s, t), b = last(s, t); int res = 0; if(a > -1 && b > -1 && b > a) res = b-a; System.out.println(res);...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
be37090da79427f31d96db7ed249836c
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
//package acc; import java.util.*; public class ACC { //************Main*****************// public static void main(String[] args) { Scanner in=new Scanner (System.in); String s=in.next(); String s1=in.next(); ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
1c9b1ae95239d93f8c48bca3f44df6c0
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.*; import java.util.*; public class Main { BufferedReader in; PrintWriter out; StringTokenizer st; char[] s, t; int n, m; void solve() throws IOException { s = in.readLine().toCharArray(); t = in.readLine().toCharArray(); n = s.length; m = t.length; int l = 0, r = m - 1; boolean wa...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
39f16067f51bc497b9d99a6540924756
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.*; import java.util.*; public class NameQuest { public static void main(String[] args) throws IOException { in.init(System.in); String needle = in.next(); String haystack = in.next(); int begin = -1; int end = -2; int p = 0; int n = needle.length(); int m = haystack.length(); for(in...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
255e0f00f08487bdbea58ced58d52700
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); String t = sc.nextLine(); int l = 0; int si = 0; while (l < t.length() && si < s.length()) { if (s.charAt(s...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
a945766467f57e3c45cf503ce6704f00
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class C { public static void main (String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String s = bf.readLine(); String t = bf.readLine(); int q = 0; ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
2c8d209bd776ac639a5283c3ae4512f1
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
fa54a84472729fa92cadc49e3296c014
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); char[] name = scanner.next().toCharArray(); char[] chars = scanner.next().toCharArray(); int left = 0; int right = chars.length - 1; int ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
845c9a7c6322572b625e19f40378daf4
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.Scanner; /** * http://codeforces.ru/contest/523/problem/C * * Created by duviteck on 14/03/15. */ public class Problem_C { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); char[] s = scanner.nextLine().toCharArray(); char[] t = scanne...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
b45df5b5d7a3b4ef40b3aae3bed41e5e
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
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.Bit...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
6392528c3ea491d13a84a59a654ddfa1
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.Scanner; /** * Created by bulbigood on 14.03.15. */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String name = sc.next(); String str = sc.next(); int h = 0; int a = 0; boolean est = false; ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
a69bedae61abb88ed18fb8a931dcfffd
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top * @author Artem Gilmudinov */ public ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
302452e75c1f731cb0b500c50502f0a3
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class VKCupC2 { static BufferedReader in; static PrintWriter out; static StringTokenizer st; static String next() throws IOException { while (st == nu...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
3648f2382b6582c512c3c054ee4ecccd
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.Scanner; /** * Created by loremon long time ago. */ import java.util.ArrayList; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); String s1, s2; char [] a, b; int n, m, i, j, ans=1000000000; ArrayList <Inte...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
05451d3329b9e3ea713af77cdbd2fb51
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static BufferedReader cin; static StringTokenizer tok; public static String nextToken() throws Exception { if (tok == null || !tok.hasMoreTokens()) { tok = new StringTokenizer(cin.readLine()); } return tok.nextToken(); } pu...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
072ffb7f7f27c64553c3843355bbd529
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class C { FastScanner in; PrintWriter out; ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
1c9fb4555bbfa8bacd77fc904e74dec6
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws IOException { BufferedReader scan = new BufferedReader...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
ec391f173df81e8b0a99c6c1d2e8d947
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.*; import java.util.*; public final class name_quest { static FastScanner sc=new FastScanner(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter out=new PrintWriter(System.out); static ArrayList<Integer>[] al; @SuppressWarnings("unchecked") public static void main(Strin...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
d6b426f03f86f9bae26815e72e9aa0e2
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
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 { // final Scanner sc = new Scanner(System.in); final BufferedReader br = new BufferedReader(new InputStreamReader(System.in))...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
2e6eaa8f5e088ee5996bcaaeb4e11951
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author coldhands */ import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import stati...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
813448fed4530e058f2464b6e968cff4
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; import static java.lang.Math.*; public class Solution implements Runnable { void solve() throws Exception { String s = sc.nextToken(); String t = sc.nextToken(); int lf = t.length(); for (int i = 0, j = 0; i < t.le...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
1bf9ad8b091ba1c4ac0162e52042c5ed
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) { Scanner input = new Scanner(System.in); String s = input.next(); String t = input.next(); boolean stop = false; int pos_s = 0; int pos_1 = -1; int pos_2 = -1; boolean found = false; for(int i = 0; i < t.leng...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
93119d09683753666359a895e167546b
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.*; import java.util.*; public class VK_C { static Scanner in = new Scanner(System.in);; static PrintStream out = System.out; static char[] s, t; public static void main(String[] args) { s = in.nextLine().toCharArray(); t = in.nextLine().toCharArray(); int i=0; int j=0; int first_end=-1;...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
9a637ec623df28d76e6c679bda82b847
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static class NameSearcher { String s = null; String t = null; public void setS(String s) { this.s = s; } public void setT(String t) { ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
1d4c2cf6358c57e57bc6207760ff310b
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { private static class Geometry { public static boolean check3DotsOnLine(int x1, int y1, int x2, int y2, int x3, int y3) { ...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
3b989fc45adcff81b4fcb6eda48e47fb
train_000.jsonl
1426345200
A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by removing zero or more letters (at that, the remaining letters remain in the same order), he gets happy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; public class C { static InputStreamReader isr = new InputStreamReader(System.in); static BufferedReader br = new BufferedR...
Java
["aba\nbaobababbah", "mars\nsunvenusearthmarsjupitersaturnuranusneptune"]
2 seconds
["2", "0"]
null
Java 7
standard input
[ "*special", "greedy" ]
724fa4b1d35b8765048857fa8f2f6802
The first line contains string s, consisting of lowercase English letters. The length of string s is from 1 to 1000 letters. The second line contains string t, that also consists of lowercase English letters. The length of string t is from 1 to 106 letters.
1,400
Print the sought number of ways to cut string t in two so that each part made s happy.
standard output
PASSED
01da3e49b62a1f3ff314ded5f49f112d
train_000.jsonl
1564497300
There is a country with $$$n$$$ citizens. The $$$i$$$-th of them initially has $$$a_{i}$$$ money. The government strictly controls the wealth of its citizens. Whenever a citizen makes a purchase or earns some money, they must send a receipt to the social services mentioning the amount of money they currently have.Somet...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { public static void process()throws IOException { int n=ni(),arr[]=new int[n+1]; for(int i=1;i<=n;i++) arr[i]=ni(); int q=ni(),query_no_2[]=new int[q+1],query_no_1[]=new int[n+1]; for(int i=1;i<=q;i++...
Java
["4\n1 2 3 4\n3\n2 3\n1 2 2\n2 1", "5\n3 50 2 1 10\n3\n1 2 0\n2 8\n1 3 20"]
2 seconds
["3 2 3 4", "8 8 20 8 10"]
NoteIn the first example the balances change as follows: 1 2 3 4 $$$\rightarrow$$$ 3 3 3 4 $$$\rightarrow$$$ 3 2 3 4 $$$\rightarrow$$$ 3 2 3 4In the second example the balances change as follows: 3 50 2 1 10 $$$\rightarrow$$$ 3 0 2 1 10 $$$\rightarrow$$$ 8 8 8 8 10 $$$\rightarrow$$$ 8 8 20 8 10
Java 11
standard input
[ "data structures", "binary search", "sortings", "brute force" ]
7b788c660fb8ca703af0030f4c84ce96
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^{5}$$$) — the numer of citizens. The next line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($$$0 \le a_{i} \le 10^{9}$$$) — the initial balances of citizens. The next line contains a single integer $$$q$$$ ($$$1 \le q \le 2 \...
1,600
Print $$$n$$$ integers — the balances of all citizens after all events.
standard output
PASSED
dee0b1932d837a2ab622e2ae78cdd6f5
train_000.jsonl
1564497300
There is a country with $$$n$$$ citizens. The $$$i$$$-th of them initially has $$$a_{i}$$$ money. The government strictly controls the wealth of its citizens. Whenever a citizen makes a purchase or earns some money, they must send a receipt to the social services mentioning the amount of money they currently have.Somet...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class B { public static void process()throws IOException { int n = ni(), arr[] = new int[n+1], latest_query[] = new int[n+1]; for(int i = 1; i<=n; i++) arr[i] = ni(); int q = ni(), query[] = new int[q+2]; // query[] hold...
Java
["4\n1 2 3 4\n3\n2 3\n1 2 2\n2 1", "5\n3 50 2 1 10\n3\n1 2 0\n2 8\n1 3 20"]
2 seconds
["3 2 3 4", "8 8 20 8 10"]
NoteIn the first example the balances change as follows: 1 2 3 4 $$$\rightarrow$$$ 3 3 3 4 $$$\rightarrow$$$ 3 2 3 4 $$$\rightarrow$$$ 3 2 3 4In the second example the balances change as follows: 3 50 2 1 10 $$$\rightarrow$$$ 3 0 2 1 10 $$$\rightarrow$$$ 8 8 8 8 10 $$$\rightarrow$$$ 8 8 20 8 10
Java 11
standard input
[ "data structures", "binary search", "sortings", "brute force" ]
7b788c660fb8ca703af0030f4c84ce96
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^{5}$$$) — the numer of citizens. The next line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($$$0 \le a_{i} \le 10^{9}$$$) — the initial balances of citizens. The next line contains a single integer $$$q$$$ ($$$1 \le q \le 2 \...
1,600
Print $$$n$$$ integers — the balances of all citizens after all events.
standard output
PASSED
a3e0466bc1b14e2da21f0ba32999807b
train_000.jsonl
1564497300
There is a country with $$$n$$$ citizens. The $$$i$$$-th of them initially has $$$a_{i}$$$ money. The government strictly controls the wealth of its citizens. Whenever a citizen makes a purchase or earns some money, they must send a receipt to the social services mentioning the amount of money they currently have.Somet...
256 megabytes
import java.io.BufferedOutputStream; import java.io.Closeable; import java.io.DataInputStream; import java.io.Flushable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.InputMismatchException; /** * Built using CHelper plug-in * Actual solution is at the top */ ...
Java
["4\n1 2 3 4\n3\n2 3\n1 2 2\n2 1", "5\n3 50 2 1 10\n3\n1 2 0\n2 8\n1 3 20"]
2 seconds
["3 2 3 4", "8 8 20 8 10"]
NoteIn the first example the balances change as follows: 1 2 3 4 $$$\rightarrow$$$ 3 3 3 4 $$$\rightarrow$$$ 3 2 3 4 $$$\rightarrow$$$ 3 2 3 4In the second example the balances change as follows: 3 50 2 1 10 $$$\rightarrow$$$ 3 0 2 1 10 $$$\rightarrow$$$ 8 8 8 8 10 $$$\rightarrow$$$ 8 8 20 8 10
Java 11
standard input
[ "data structures", "binary search", "sortings", "brute force" ]
7b788c660fb8ca703af0030f4c84ce96
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^{5}$$$) — the numer of citizens. The next line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($$$0 \le a_{i} \le 10^{9}$$$) — the initial balances of citizens. The next line contains a single integer $$$q$$$ ($$$1 \le q \le 2 \...
1,600
Print $$$n$$$ integers — the balances of all citizens after all events.
standard output
PASSED
1aa7b6132b7e12b88b2f34f28fa97e26
train_000.jsonl
1564497300
There is a country with $$$n$$$ citizens. The $$$i$$$-th of them initially has $$$a_{i}$$$ money. The government strictly controls the wealth of its citizens. Whenever a citizen makes a purchase or earns some money, they must send a receipt to the social services mentioning the amount of money they currently have.Somet...
256 megabytes
import java.io.*; import java.util.*; public class A { static FastReader f = new FastReader(); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { int n = f.nextInt(); Pair[] pairs = new Pair[n]; for(int i=0;i<n;i++) { pairs[i]...
Java
["4\n1 2 3 4\n3\n2 3\n1 2 2\n2 1", "5\n3 50 2 1 10\n3\n1 2 0\n2 8\n1 3 20"]
2 seconds
["3 2 3 4", "8 8 20 8 10"]
NoteIn the first example the balances change as follows: 1 2 3 4 $$$\rightarrow$$$ 3 3 3 4 $$$\rightarrow$$$ 3 2 3 4 $$$\rightarrow$$$ 3 2 3 4In the second example the balances change as follows: 3 50 2 1 10 $$$\rightarrow$$$ 3 0 2 1 10 $$$\rightarrow$$$ 8 8 8 8 10 $$$\rightarrow$$$ 8 8 20 8 10
Java 11
standard input
[ "data structures", "binary search", "sortings", "brute force" ]
7b788c660fb8ca703af0030f4c84ce96
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^{5}$$$) — the numer of citizens. The next line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ ($$$0 \le a_{i} \le 10^{9}$$$) — the initial balances of citizens. The next line contains a single integer $$$q$$$ ($$$1 \le q \le 2 \...
1,600
Print $$$n$$$ integers — the balances of all citizens after all events.
standard output
PASSED
e8ec299cdfe826632c4d6aef9f15fca6
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
public class C { public Object solve () { int N = sc.nextInt(); long [] B = sc.nextLongs(); long [] res = new long [N]; int M = N/2; for (int i : rep(M)) res[M+i] = B[M-1-i]; for (int i : rep(1, M)) { int j = N-1-i; if (res[i] < res[i-1]) { long D = res[i-1] - res[i]; res[i] += D; ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
8afb0851ad23b5208551c29e23fff7a0
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import javafx.util.Pair; public class CodeForce { static boolean flag = false; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
9a919fbe5a7194847e953557db27836c
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class A_GENERAL { static long seive_size = (long) 1e6; static ArrayList<Integer> primes = new ArrayList<>(); static boolean[] set = new boolean[(int) seive_size+1]; static ArrayLis...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
66d29d30f2fa673d6f82743ee7503808
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); long[] tmp = new long[n / 2]; long arr[] = new long[...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
658fe3c3d7e52b98e6e5298a0a118daa
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import sun.applet.Main; import java.util.ArrayList; import java.util.Scanner; /** * Created by jai on 15/12/18. */ public class p1093c { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long a[] = new long[n]; long min = 0; ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
2e9a95668ebdbb52701d941c5b07171a
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; public class _c7 { public static void main(String args[]){ PrintWriter out = new PrintWriter(System.out); Reader in = new Reader(); int n = in.nextInt(); lo...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
3d74b2655ea9359e34696c4d32e61b49
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.io.*; import java.util.*; public class Main implements Runnable { int maxn = (int)1e5+11; int inf = (int)1e9; long mod = (long)1e9+7; int n,m,k; int a[] = new int[n]; void solve() throws Exception { n = in.iInt(); long a[] = new long[n+1]; long b[] = new l...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
ff6cbed1e8c06c8e4b90ee7d01aea6ca
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class JavaApplication7 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int n; long k,t = 0; Scan...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
f682bd29e8298140fabadd556cd340f4
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class JavaApplication7 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int n; long k,t = 0; Scan...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
654354fbe702e8287c9bba9a2e7944c4
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class C { public static void main(String[] args) { FastReader in = new FastReader(); int n = in.nextInt(); long[] ans = new long[n]; for(int i = 0; i < n/2; i++) { if(i ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
9cb6b95689e861563b334f49da20a85f
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.*; public class C1093{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int t = n/2; long b[] = new long[t]; for(int i = 0;i<t;i++){ b[i] = sc.nextLong(); } long a[] = new long[n]; for(int i = t-1;i>=0;i--){ // for(int j = t-1;j>=...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
deeaa81c0a6250a5ff981803c8fab0b8
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.net.*; import java.applet.*; import java.awt.*; import java.awt.event.*; public class cf { public static void main(String args[]) { Scanner in=new Scanner(System.in); int n=in.nextInt(); long[] a=new long[n]; ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
e1731907ad75fee3743e30ec90007c95
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
//package Codeforces; import java.util.*; public class exam { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] arr = new long[n / 2]; for (int i = 0; i < n / 2; i++) arr[i] = in.nextLong(); long[] ans = new long[n]; for (int i = 0; i < n / 2; i...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
48f011a1f0f13e20ef5d561616bdd468
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ static ArrayList<Integer> a[]; static boolean[] v; static class pair implements Comparable<pair>{ int a,b; pair(int x,int y){ a=x;b=y; } public int compareTo(pair t){ if(t.a==this.a) ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
2fd3444f230b547babfb3aa308f5e858
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.lang.*; import java.math.*; import java.text.*; import java.io.*; public final class Solve { static PrintWriter out = new PrintWriter(System.out); static void flush() { out.flush(); } static void run(long s, long e) { NumberFormat formatter = ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
8552f4b90025b07e468b195cd9b8a746
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class Main { public static long[] f(long l,long r, long c) { long a = l; long b = r; long[] p = new long[2]; p[0] = a; p[1] = b; if (a + b == c) return p; if ((a + b) < c) { a = c - b; } else { b = c - a; } p[0] = a; ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
065a2b01af23b526b102086f462bb5c3
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public static class MyScanner { BufferedReader br; StringTokenizer st; pub...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
4564b84ab3740920f5f1d729a64861ea
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import java.util.stream.Collectors; import java.util.stream.IntStream; public class Solution { public static long[] toLongArray(String s) { String nums[] = s.split("\\s"); return IntStream.range(0, nums.length) .mapToLong(index -> Long.parseLong(nums[index]...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
f62b8f8941de9146a8cbae82a7cb36fe
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import org.omg.CORBA.MARSHAL; import java.awt.event.InputEvent; import java.awt.image.AreaAveragingScaleFilter; import java.io.*; import java.net.CookieHandler; import java.util.*; import java.math.*; import java.lang.*; public class Main implements Runnable { static class InputReader { private InputStre...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
168b767f8fba04943c9c79b69394da16
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; i...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
2c6fe24f2fa1615d08f04eb12e9876d4
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import java.math.*; public class Main extends Thread { boolean[] prime; FastScanner sc; PrintWriter pw; long startTime = System.currentTimeMillis(); final class FastScanner { BufferedReader br; StringTokenizer st; pu...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
6fded10eaf6bbdfe707f406963ad7082
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; public class TestClass1 { public static void main(String[] args) { Scanner s = new Scanner(System.in); String name = s.nextLine(); int t = Integer.parseInt(name); name = s.nextLine(); String[] spl = name.split(" "); BigInteger[] b = new BigInteger[...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
6a90a8dee5a7f701084fb1eeb3b53aef
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.*; public class C{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int nb = sc.nextInt(); long tab[] = new long[nb]; long min=0; long max=sc.nextLong(); tab[0]=min; tab[nb-1]=max; long encours; for (int i=1;i<(nb/2);i++){ encours=sc.nextLong()-min; ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
7cd200d48e9b8b54188dc0343dec18dc
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class ProblemC { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); long [] nums = new long[n/2]; for (int i = 0; i < nums.length; i++) { nums[i] = scan...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
d2d5c37cf8706e08c1a720bcc618d949
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class ProblemC { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); long[] nums = new long[n / 2]; for (int i = 0; i < nums.length; i++) { nums[i] = sca...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
c55226990927540394cf98b28975b90d
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.*; import java.io.*; import java.lang.reflect.Array; import java.math.*; public class Main { static int N = (int)1e5 + 10; public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(System.in); long[] b = new long[N]; long[][] a = new long[2][N]; ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
d55f07ff24bfeb5f066dc99c935243b4
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.*; import java.io.*; import java.lang.reflect.Array; import java.math.*; public class Main { static int N = (int)1e5 + 10; public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(System.in); long[] b = new long[N]; long[][] a = new long[2][N]; ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
9628782008d2ace8aa4e6c1d61dd9e8f
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.*; import java.io.*; import java.lang.reflect.Array; import java.math.*; public class Main { static int N = (int)1e5 + 10; public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(System.in); long[] b = new long[N]; long[][] a = new long[2][N]; ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
e5503161d4a07d1d64bf5426998a9896
train_000.jsonl
1544884500
Mishka is trying really hard to avoid being kicked out of the university. In particular, he was doing absolutely nothing for the whole semester, miraculously passed some exams so that just one is left.There were $$$n$$$ classes of that subject during the semester and on $$$i$$$-th class professor mentioned some non-neg...
256 megabytes
import java.util.*; public class C { public static void main(String[]args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); long[]b=new long[n/2]; long[]b2=new long[n/2]; for(int i=0;i<n/2;i++) b[i]=sc.nextLong(); long r=Long.MAX_VALUE,p=0; for(int i=0;i<n/2;i++){ b2[i]=Math.min(r,b[i]-p); ...
Java
["4\n5 6", "6\n2 1 2"]
2 seconds
["2 3 3 3", "0 0 1 1 1 2"]
null
Java 8
standard input
[ "greedy" ]
4585419ab2b7200770cfe1e607161e9f
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of sequence $$$a$$$. $$$n$$$ is always even. The second line contains $$$\frac n 2$$$ integers $$$b_1, b_2, \dots, b_{\frac n 2}$$$ ($$$0 \le b_i \le 10^{18}$$$) — sequence $$$b$$$, where $$$b_i = a_i + a_{n - i + 1}$$$. It i...
1,300
Print $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$) in a single line. $$$a_1 \le a_2 \le \dots \le a_n$$$ should be satisfied. $$$b_i = a_i + a_{n - i + 1}$$$ should be satisfied for all valid $$$i$$$.
standard output
PASSED
a2e1b1f566c831af83f4d806ef52dafd
train_000.jsonl
1380295800
You are given an array a1, a2, ..., an and m sets S1, S2, ..., Sm of indices of elements of this array. Let's denote Sk = {Sk, i} (1 ≤ i ≤ |Sk|). In other words, Sk, i is some element from set Sk.In this problem you have to answer q queries of the two types: Find the sum of elements with indices from set Sk: . The que...
256 megabytes
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Alexandr Azizyan */ public class Main { public static void main(String[...
Java
["5 3 5\n5 -5 5 1 -4\n2 1 2\n4 2 1 4 5\n2 2 5\n? 2\n+ 3 4\n? 1\n+ 2 1\n? 2"]
3 seconds
["-3\n4\n9"]
null
Java 7
standard input
[]
9e1b04e8049eeb87060a0439e31530b5
The first line contains integers n, m, q (1 ≤ n, m, q ≤ 105). The second line contains n integers a1, a2, ..., an (|ai| ≤ 108) — elements of array a. Each of the following m lines describes one set of indices. The k-th line first contains a positive integer, representing the number of elements in set (|Sk|), then foll...
2,500
After each first type query print the required sum on a single line. Please, do not write the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.
standard output
PASSED
999f1d5bce01b2e082001c94af01bd94
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Codeforce...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
21428f328b945ecd72dfbbf39bc9510b
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.*; import java.io.*; import java.lang.Math; public class Main{ static int maxDivisor(int n){ for (int i=n-1;i>=1;i--){ if(n%i==0){ return i; } } return -1; } public static void main(String[] args){ FastScanner s = new FastSc...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
ffcc20870091f0b80f16d9455ebc50b3
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-->0){ int n = s.nextInt(); int[] arr = new int[2*n]; ArrayList<Integer> listo = new Arra...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
87d45b0029f1e1db83be6f436a20806c
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner scanner=new Scanner(System.in); int t=scanner.nextInt(); while(t>0){ int flag=0; ArrayList<Integer> a=new ArrayList<Integer>(); ArrayList<Integer> b=new ArrayList<Integer>(); ...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
3a1d3792b38e75ef73a649ccb4ff4c42
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner scanner=new Scanner(System.in); int t=scanner.nextInt(); while(t>0){ int flag=0; ArrayList<Integer> a=new ArrayList<Integer>(); ArrayList<Integer> b=new ArrayList<Integer>(); ...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
e6421d821283bbb4d3905ef6cc36326a
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner scanner=new Scanner(System.in); int t=scanner.nextInt(); while(t>0){ int flag=0; ArrayList<Integer> a=new ArrayList<Integer>(); ArrayList<Integer> b=new ArrayList<Integer>(); ...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
876d956477f6047273458e05b789ede1
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args){ Scanner input = new Scanner(System.in); int tc = input.nextInt(); while(tc-->0) { int n = input.nextInt(); int a[] = new int[n*2]; ...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
da0608a9768431305e890a4a08539a1f
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.InputMismatchException; public class A { public static void main(String[] args) throws Exception { // TODO Auto-generated m...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
38211e32261e1e767645c55287a39894
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class Solution { public static int gcd(int a,int b){ if(a==1 ||b==1) return 1; if(b==0) return a; return gcd(...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
b7b0324c85cc65408fb73bbbc5907f9d
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.*; import java.io.*; public class GCD_Compression { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st =...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
eb3c91bcb908e17f6224c52900025d96
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
/* Aman Agarwal algo.java */ import java.util.*; import java.io.*; public class C { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
62bbcb96219540ed97ce61fe2589c9b2
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.LinkedList; import java.util.StringTokenizer; /** * I realized that you might have doubt in this question, so if at some point in my * code you find anything that you don't under...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
b71413ed7b5e4d212dbda1999341250a
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; import java.util.Stack; public class Main { public static void test() { } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { int size = sc.nextInt(); ...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
ceab4a5e073bc2e702d62fdfbdbebeb0
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; /** * Built using CHelper plug-in * Actual solution is at the top */ public class AA { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; ...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
d23979a65404a92a40490bbe39d3ad25
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; /** * * @author milon */ public class GCD_Compression { public static void main(String[] args) { FastScanner fs=new FastScanner(); int ...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
30f9121e63469c602186c5315601a8fe
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.awt.Point; //ArrayList<Integer> ar=new ArrayList<Integer>(); //HashSet<Integer> h=new HashSet<Integer>(); //HashMap<Integer,Integer> h=new HashMap<Integer, Integer>(); //int b[]=new int[m]; //int a[]=new int[n]; //for(i=0;i<n;i++) //a[i]=sc.ni(); //...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
adce047fd13c339fca83096f0122acd8
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.InputMismatchException; import java.util.*; import java.io.*; import java.lang.*; public class Main{ public static class InputReader { private InputStream stream; ...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
d3197e3b9c32ce9a58e12ef4169ec6d7
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class Solution { static final FS sc = new FS(); static final PrintWriter pw = new PrintWriter(System.out); public stat...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
6be2ebf3b5e8e52a8ac89b36afacc836
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
// Working program using Reader Class import java.io.*; import java.util.*; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStrea...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
7a8a351ee0dbe5237db172a83fa11d72
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.*; import java.lang.*; public final class TestB { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { int n=sc.nextInt(); int val=2*n; int[] a=new int[val]; ...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
8d6ef405e8cea94bc9ddd0b2b04b7d2c
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Integer.*; import static java.lang.Long.*; import static java.lang.System.*; public class B { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWri...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
762069bf83099b910704e7af6ddff0a1
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.*; import java.math.*; public class GDCCompression { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int runs = sc.nextInt(); while(runs-->0) { int n = sc.nextInt(); ArrayList<Integer> even = new ArrayList<>(); ArrayList<Integer> odd = new ArrayL...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
97cf0aef2b64cc1939214507e4b1a085
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
//package test.codeforce.c651; import java.util.ArrayList; import java.util.List; import java.util.Scanner; /** * @author Lin * @version 1.0 * @date 2020/6/20 22:36 */ public class B { public static void main(String[] args) { Scanner input = new Scanner(System.in); int testNum = input.nextInt(); StringBu...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
5495cd9031e8649607139eb1d8f29a55
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import java.math.*; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); while(t>0){ int n=s.nextInt(); int arr[]=new int[2*n]; for(int i=0;i<2*n;i++){ arr[i]=s.nextInt(); } ...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
8de10eef1d05001e753a7e8f5059b1bc
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.Scanner; import java.math.BigInteger; import java.util.Arrays; import java.util.ArrayList; import java.util.*; import java.util.List; import java.lang.Math; import java.util.HashMap; public class javasample { static boolean isPrime(int n) { // Corner cases if (n <= 1) return fal...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
163e0140aa872d24bf368cb908833fca
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.*; import java.util.*; public class MyClass { public static void main(String args[])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out)); int t=Integer.parseInt(b...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
558b05a2684885b51772d76851e0a37d
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.time.LocalTime; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class B { public static void main(String[] args) { FastScanner scan = new FastScanner(); int t = scan....
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
0de0414a8f0636944db5e11d76625687
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.time.LocalTime; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class B { public static void main(String[] args) { FastScanner scan = new FastScanner(); int t = scan....
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
af56a73855b6ea1ae0e9e1451a4d1f10
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int test = Integer.parseInt(br.readLine()); String line[] = null;...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
8b310d9e4a7ee85b2fb767bd4b6950ea
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ static PrintWriter out=new PrintWriter(System.out); public static void main (String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String[] input=br.readLine().trim().split(" "); int numTestCas...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
09eb846dfe9d8923ae41480db4206c8d
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
256 megabytes
import java.io.*; public class Compression { public static void main(String args[])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int test=Integer.parseInt(br.readLine()); for(int t=1;t<=test;t++) { int n=Integer.parseInt(...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
391c46796766a0b8bd53e3c8137506f8
train_000.jsonl
1592663700
Ashish has an array $$$a$$$ of consisting of $$$2n$$$ positive integers. He wants to compress $$$a$$$ into an array $$$b$$$ of size $$$n-1$$$. To do this, he first discards exactly $$$2$$$ (any two) elements from $$$a$$$. He then performs the following operation until there are no elements left in $$$a$$$: Remove any...
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(); Map<Integer,Integer> even = new HashMap<Integer,Integer>(); Map<Integer,Integer> odd = new Ha...
Java
["3\n3\n1 2 3 4 5 6\n2\n5 7 9 10\n5\n1 3 3 4 5 90 100 101 2 3"]
1 second
["3 6\n4 5\n3 4\n1 9\n2 3\n4 5\n6 10"]
NoteIn the first test case, $$$b = \{3+6, 4+5\} = \{9, 9\}$$$ and $$$\mathrm{gcd}(9, 9) = 9$$$.In the second test case, $$$b = \{9+10\} = \{19\}$$$ and $$$\mathrm{gcd}(19) = 19$$$.In the third test case, $$$b = \{1+2, 3+3, 4+5, 90+3\} = \{3, 6, 9, 93\}$$$ and $$$\mathrm{gcd}(3, 6, 9, 93) = 3$$$.
Java 8
standard input
[ "constructive algorithms", "number theory", "math" ]
96fac9f9377bf03e144067bf93716d3d
The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 10$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$2 \leq n \leq 1000$$$). The second line of each test case contains $$$2n$$$ integers $$$a_1, a_2, \ldots...
1,100
For each test case, output $$$n-1$$$ lines — the operations performed to compress the array $$$a$$$ to the array $$$b$$$. The initial discard of the two elements is not an operation, you don't need to output anything about it. The $$$i$$$-th line should contain two integers, the indices ($$$1$$$ —based) of the two elem...
standard output
PASSED
49fef5a0d65f50c4cc603ae04e44c76f
train_000.jsonl
1304175600
Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class B_79_Colorful_Field { @SuppressWarnings("unused") public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(), m = s.nextInt(), k = s.nextInt(), t = s.nextInt(); int[] is = new int[k]; for (int i = 0; i < k; ...
Java
["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"]
2 seconds
["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"]
NoteThe sample corresponds to the figure in the statement.
Java 7
standard input
[ "implementation", "sortings" ]
bfef3f835357dae290620efabe650580
In the first line there are four positive integers n, m, k, t (1 ≤ n ≤ 4·104, 1 ≤ m ≤ 4·104, 1 ≤ k ≤ 103, 1 ≤ t ≤ 103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines...
1,400
For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes.
standard output