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
766761a97e1417ce78e94cd23d851547
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
/* PROG: d LANG: JAVA */ import java.util.*; import java.io.*; public class d { int bs(int[] a, int lo, int hi, int cu, int t) { while(lo < hi) { int mid = (lo + hi) / 2; if(a[mid] - a[cu] < t) { lo = mid + 1; } else { hi = mid; } } return lo; } private v...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
67ae69b3f783a54d487ca3128a101f9f
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
/* PROG: d LANG: JAVA */ import java.util.*; import java.io.*; public class d { int bs(int[] a, int lo, int hi, int cu, int t) { while(lo < hi) { int mid = (lo + hi) / 2; if(a[mid] - a[cu] < t) { lo = mid + 1; } else { hi = mid; } } return lo; } private v...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
035a007a01cddbe9686169928771ba42
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
/* PROG: b LANG: JAVA */ import java.util.*; import java.io.*; public class b { int bt(int[] x, int lo, int hi, int cu, int v) { while(lo < hi) { int mid = (lo + hi) / 2; if(x[mid] - x[cu] < v) { lo = mid + 1; } else { hi = mid; } } return lo; } int bs(int[]...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
ebdad6837c880bf6f08f118d11b7e3e7
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.util.*; import java.io.*; public class b { int bt(int[] x, int lo, int hi, int cu, int v) { while(lo < hi) { int mid = (lo + hi) / 2; if(x[mid] - x[cu] < v) { lo = mid + 1; } else { hi = mid; } } return lo; } int[] bs(int[] x, int[] y, int v) { ...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
810eaa18a6587b9a4ee6944e0d5fe50b
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
/* PROG: d LANG: JAVA */ import java.util.*; import java.io.*; public class d { int bs(int[] a, int lo, int hi, int cu, int t) { while(lo < hi) { int mid = (lo + hi) / 2; if(a[mid] - a[cu] < t) { lo = mid + 1; } else { hi = mid; } } return lo; } private v...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
f319b7297a98202342efab86e15c3dd5
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.util.*; import java.io.*; public class b { int bt(int[] x, int lo, int hi, int cu, int v) { while(lo < hi) { int mid = (lo + hi) / 2; if(x[mid] - x[cu] < v) { lo = mid + 1; } else { hi = mid; } } return lo; } int[] bs(int[] x, int[] y, int v) { ...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
d644be960c3c00b4b37b4b4d44368282
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.StringTokenizer; public final cl...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
f47c907aa220214bf41258178688105e
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.util.*; public class b { public static void main(String[] args) { Scanner input = new Scanner(System.in); n = input.nextInt(); int[] data = new int[n]; for(int i = 0; i<n; i++) data[i] = input.nextInt(); TreeSet<Pair> res = new TreeSet<Pair>(); precomp(data); for(int i = 1; i<=n;...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
c96b766b952879afece22364fd044eb9
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.*; import java.util.*; public class problem496D { public static void main(String[]args)throws IOException{ BufferedReader x=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(x.readLine()); int[]arr=new int[n]; HashMap<Integer,Integer>pre1=ne...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
1b2abd5ee000b2a7883738b509fcd151
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashSet; import java.util.StringTokenizer; import java.util.TreeSet; public class D_TennisGame { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStre...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
6beededfda9f3d2de84a1bf8f8994361
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
// package Div2; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Scanner; import java.util.Stack; public class Sketch { private static final int LEN = 10000000; private static int findNext(int start, int tval, in...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
2a5c67199e7c111493a23c10682b383b
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
5076be317bb78009fbdc6c27ccebbdc3
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.StringTokenizer; public...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
d3de10a9053b2331e5e416a0177366e8
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; i...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
65dbe6204cd256ed9e5375740561d0e4
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.*; import java.util.*; public class CF_496D { public static void main(String[] args) throws IOException { new CF_496D().solve(); } int getT(int[] acc1, int[] acc2, int s){ // System.out.println("start with s: "+s); // System.out.println(Arrays.toString(acc2)); ...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
7fc701de8721efec19a9aca9defed54d
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class D { public static class Pair implements Comparable<Pair> { public int a, b; public Pair(int a, int b...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
403f8f9f4b91916e5054480b63501857
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; import static java.lang.Math.*; public class Solution implements Runnable { class Pair implements Comparable<Pair> { int x, y; Pair() { x = y = 0; } Pair(int x, int y) { this.x = x; this.y = y; } public int...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
be9fc15a1a71fc9d3b28fb74f9446914
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; public class D { public static void main(String[] args) { int N = nextInt(); int INF = 1<<30; int pos[][] = new int[2][2*N + 1]; int sum[] = new int[N+1]; Array...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
b0ce5c55a0323ca296f1312218a25783
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.util.*; import java.util.Map.Entry; public class D { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] g = new int[n]; int[] f1 = new int[n+1]; int[] f2 = new int[n+1]; int[] t1 = new int[n]; int[] t2 = new int[n]; A...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
81b6583464e35aa394fd0c6defc9ead7
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class D { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayList<Integer> A = new ArrayList<Integer>()...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
03db6ab79c7977bc3a3088c3acb4efa4
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class D_Tennis_Game { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 300000); public static int n; public static int entrada[]; public static int arr1[]; // arr1[i] é...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
fc06955589d063631b3d2792f21d7821
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; //aasd public class D_Tennis_Game { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 300000); public static int n; public static int entrada[]; public static int arr1[]; // arr...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
2f297bc41e4f4948870edf59d2fe3900
train_001.jsonl
1418833800
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player scores one point. As soon as one of the players scores t points, he wins the set; then the ne...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchException; import java.util.Linked...
Java
["5\n1 2 1 2 1", "4\n1 1 1 1", "4\n1 2 1 2", "8\n2 1 2 1 1 1 1 1"]
2 seconds
["2\n1 3\n3 1", "3\n1 4\n2 2\n4 1", "0", "3\n1 6\n2 3\n6 1"]
null
Java 7
standard input
[ "binary search" ]
eefea51c77b411640a3b92b9f2dd2cf1
The first line contains a single integer n — the length of the sequence of games (1 ≤ n ≤ 105). The second line contains n space-separated integers ai. If ai = 1, then the i-th serve was won by Petya, if ai = 2, then the i-th serve was won by Gena. It is not guaranteed that at least one option for numbers s and t corre...
1,900
In the first line print a single number k — the number of options for numbers s and t. In each of the following k lines print two integers si and ti — the option for numbers s and t. Print the options in the order of increasing si, and for equal si — in the order of increasing ti.
standard output
PASSED
fba5317bf1ea1f9b85f909419c4e56ee
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.Collection; import java.util.InputMismatchException; import java.util.HashMap; import java.io.IOException...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
e77aaf4c58a9f9ea0ba9b33a9dd4d83d
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import static java.util.Arrays.fill; import static java.lang.Math.*; import static java.util.Arrays.sort; import static java.util.Collections.sort; public class Shark { static int mod = 1000000007; static InputReader in = new InputReader(System.in); static ...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
333c6324bc90702050af87df61aeeb27
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class D { ...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
ab4efeca4ab4a21ed758fd5dfcd9d34e
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.io.*; import java.util.*; public class Shark { public static class Node { boolean loc = false; int count = 1; Node left = null; Node right = null; } public static void main (String[] args) throws Exception { BufferedReader in = new BufferedReader(new In...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
8fbfedcd119df7a535a54bfc2c271628
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
//package contests.CF484; import java.io.*; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; public class D { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); ...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
b9fa97530ceb80af749d078dca423c1b
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import java.util.Arrays; import java.util.TreeMap; import java.util.HashMap; import java.util.Comparator; import java.util.TreeSet; import java.util.Collection; import java.lang.Iterable; public class Task { public static int getOrDefault(HashMap<Integer, Integer>...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
d337c18c413851408e9efa879ce39f2c
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.io.*; import java.util.*; public class CODEFORCES { @SuppressWarnings("rawtypes") static InputReader in; static PrintWriter out; static int mx = Integer.MAX_VALUE - 1000000; public static class SegmentTree { int n; int arr[], lazy[]; SegmentTree(int n) { this.n = n; arr = new int[n <...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
9800e989b45c475ad18f727e6125eb4c
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); static int oo = (int)1e9; static int mod = 1_000_000_007; static int[] di = {-1, 1, 0, 0}; static int[] dj = {0, 0, -1, 1}; static int[...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
3716a3f3de70e01866176e20d70623f1
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.io.*; import java.util.*; /* * Heart beats fast * Colors and promises * How to be brave * How can I love when I am afraid to fall... */ //read the question correctly (is y a vowel? what are the exact constraints?) //look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) public class Main...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
518dff2dab7e110bc74222f7d5adae62
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.util.*; import java.io.*; // Solution public class Main { public static void main (String[] argv) { new Main(); } class Item implements Comparable<Item>{ int val, pos; public Item(int v, int p) { this.val = v; this.pos = p; } ...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
c551fd33163f6edfe886e9bd06d05206
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader inp = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); So...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
7b81c5a502cb98d8eb64619a6aa190de
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.LongStream; import java.util.stream.Stream; public class Main { static lo...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
5e10546412ace3950e3828d7cbf3f529
train_001.jsonl
1526574900
For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations.Max is a young biologist. For $$$n$$$ days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); Task...
Java
["8\n1 2 7 3 4 8 5 6", "6\n25 1 2 3 14 36"]
1 second
["7", "2"]
NoteIn the first example the shark travels inside a location on days $$$1$$$ and $$$2$$$ (first location), then on $$$4$$$-th and $$$5$$$-th days (second location), then on $$$7$$$-th and $$$8$$$-th days (third location). There are three locations in total.In the second example the shark only moves inside a location on...
Java 8
standard input
[ "data structures", "dsu", "trees", "brute force" ]
b3d093272fcb289108fe45be8c72f38e
The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of days. The second line contains $$$n$$$ distinct positive integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$) — the distance traveled in each of the day.
1,900
Print a single integer $$$k$$$, such that the shark was in each location the same number of days, the number of locations is maximum possible satisfying the first condition, $$$k$$$ is smallest possible satisfying the first and second conditions.
standard output
PASSED
76e9c4bd248beacaf2cf910b056c1085
train_001.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int q = scanner.nextInt(), c, m, x; for (int i = 0; i < q; i++) { c = scanner.nextInt(); m = scanner.nextInt(); x = scanner.next...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
0e31c2fc1df1d8ceed375b345564c888
train_001.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
//package codeChefSep19; import java.io.*; import java.util.*; public class ICPC { public static void main(String[] args)throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int q=Integer.parseInt(br.readLine()); for(int i=0;i<q;i++) { StringTokenizer st=new StringTokenizer(br...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
510f5b8397656c136e9ef446528b149e
train_001.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.Scanner; public class C1221 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int q = scan.nextInt(); while(q-- > 0) { int c = scan.nextInt(); int m = scan.nextInt(); int x = scan.nextInt(); int noOfTeams = 0; int min = Math.min(c,m); if(min>x)...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
c5bf0499dba1be98546e914629a99893
train_001.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.util.Scanner; public class C1221 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int q = scan.nextInt(); while(q-- > 0) { int c = scan.nextInt(); int m = scan.nextInt(); int x = scan.nextInt(); System.out.println(Math.min(Math.min(c, m), (c+m+x)/3)); ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
43616f8415a0628e5f3d6c91b78c2b29
train_001.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.*; import java.util.*; /*CODE BY SHIKHAR TYAGI*/ public class C { public static void main(String args[]) { FastScanner scn = new FastScanner(); int q = scn.nextInt(); while (q-- > 0) { int c = scn.nextInt(); int m = scn.nextInt(); int x = ...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
ab2d8a9f066af0da2a4d3140bd0321f1
train_001.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer; import org.omg.CORBA.INTERNAL; import org.omg.CORBA.MARSHAL; import javax.swing.plaf.basic.BasicTreeUI; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Main { private static Scanner s...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
1c24a10f55af62494b06a5f12b808a5e
train_001.jsonl
1568903700
You may have already known that a standard ICPC team consists of exactly three members. The perfect team however has more restrictions. A student can have some specialization: coder or mathematician. She/he can have no specialization, but can't have both at the same time.So the team is considered perfect if it includes...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStream; import java.util.HashSet; public class Main { public static void main(Strin...
Java
["6\n1 1 1\n3 6 0\n0 0 0\n0 1 1\n10 1 10\n4 4 1"]
2 seconds
["1\n3\n0\n0\n1\n3"]
NoteIn the first example here are how teams are formed: the only team of 1 coder, 1 mathematician and 1 without specialization; all three teams consist of 1 coder and 2 mathematicians; no teams can be formed; no teams can be formed; one team consists of 1 coder, 1 mathematician and 1 without specialization, the re...
Java 8
standard input
[ "binary search", "math" ]
b18dac401b655c06bee331e71eb3e4de
The first line contains a single integer $$$q$$$ ($$$1 \le q \le 10^4$$$) — the number of queries. Each of the next $$$q$$$ lines contains three integers $$$c$$$, $$$m$$$ and $$$x$$$ ($$$0 \le c, m, x \le 10^8$$$) — the number of coders, mathematicians and students without any specialization in the university, respect...
1,200
Print $$$q$$$ integers — the $$$i$$$-th of them should be the answer to the $$$i$$$ query in the order they are given in the input. The answer is the maximum number of full perfect teams you can distribute your students into.
standard output
PASSED
337e01199bbf43f414e8ca8f9465b983
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.util.*; import java.io.*; public class A { public static boolean isPosInt(StringBuilder str, int s, int e) { if (e - s < 1 || (str.charAt(s) == '0' && e - s > 1)) return false; for (int i = s; i < e; i++) if (!isDigit(str, i)) return false; ...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
cd0da545737374271c6763c69876fb5f
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.util.ArrayList; 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 ...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
dbc4e2230ad7e53b1ad6102d4119d9a0
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main { public static boolean isNumeric(String str) { return str.matches("-?\\d+(\\\\d+)?"); //match a number with optional '-' and decimal. } public static void main(String[] args) { Scanner sc=new Scanner(Sys...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
25bbc179c1e56ade054e3fe93826790e
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class ECR2A { public static void main(String[] args) { FastScanner in=new FastScanner(); char[] s=in.nextToken().toCharArray(); int n=s.length; ...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
724bb534a2d7b1e6a2641f6dae6da03f
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.util.Scanner; import java.util.List; import java.util.ArrayList; public class A { public boolean isDelimita(char ch) { if(ch == ',' || ch == ';')return true; return false; } public boolean isDigit(String s) { if(s.length() == 0)return false; if(s.length()...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
24947040a5fde646828c89d33a474df3
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { static BufferedReader in; static PrintWriter out; public static void main(String[] args) throws IOException { in = new BufferedReader(new ...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
5173bf6883d15a3cf981a0b40f9d5b2a
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; public class ExtractNumbers { public static void main(String args[]){ Scanner scan=new Scanner(System.in); String s=scan.next(); StringBuilder num=new StringBuilder(""),other=new StringBuilder(""); String[] next= s.split("[,;]",-1); for(int i=0;i<next...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
4ad6e05085aa49e8f8141b9d287dda20
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.StringTokenizer; /** * Created by peacefrog on 12/10/15. * Time : 3:56 AM */ public class CF600A { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; PrintWriter out; long timeBegin, timeEnd; public void runIO() throws IOExce...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
802fa2f0c78d51a75dac5ad1b6c76de0
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class intro{ public static void main(String[] args) throws IOException{ BufferedReader vod=new BufferedReader(new InputStreamReader(System.in)); String str=vod.readLine(); StringBuilder a=new StringBuilder(); S...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
4710474a5f8c68fe5a44c075e10c8429
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.*; import java.util.*; /** * Created by pkumar on 11/27/2015. */ public class ExactNumbers { private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); private static int pos; pu...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
ddb05f82529f3ac4381362d33f3bca79
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.util.*; public class A { public static void main(String[] args) { Scanner qwe = new Scanner(System.in); char[] str = qwe.next().toCharArray(); StringBuilder part1 = new StringBuilder(""); StringBuilder part2 = new StringBuilder(""); boolean[] isfirst = new boolean[2]; for (int i ...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
823e9a507a70abe1a249c6f2783744a5
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static String convertToString(ArrayList<String> words) { if (words.size() == 0) { return "-"; } StringBuilder result = new StringBuilder("\""); for (int i = 0; i < words.size() - 1; ++i) { result.append(words.get(i)); res...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
1445b736ea7f5f8e5d203b7604f2c73a
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; public class Main{ // split de array public static int[] readInts(String cad) { String read[] = cad.split(" "); int res[] = new int[read.lengt...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
2749457b1c9fd80d2c61b3bf6e7b6a09
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A_ExtractNumbers { static boolean debugging = false; static BufferedReader in; static StringTokenizer st; static StringBuilder a, b; public static void main(String[] ar...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
3ed92ded902001a95e9a103b96d19d93
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner in = new Scanner(System.in); String line = in.nextLine(); ArrayList<String> words = new ArrayList<>(); int startIndex = 0; for(int i = 0; i < line.length(); i++) { if(line.charAt(i...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
d51fa62f2c02c431f27b6e95bd0f4a45
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throw...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
6db77dfd59dc8ab242cb371b4fb97dcb
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; import java.util.regex.Pattern; public class P600A { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String str = scanner.next(); int start = 0; int type = 1; StringBuilder a = new StringBuilder(); String...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
9ba1fb32b51cd60fbf04507f7c9d8916
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; /** * Nov 27, 2015 | 4:06:13 PM * <pre> * <u>Description</u> * * </pre> * * @author Essiennta Emmanuel (colourfulemmanuel@gmail.com) */ public class ProblemA{ void solve(String string){ List<String> strings = new ArrayLi...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
2910cd4a4513c34db8dd5d367da599ac
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.InputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; import java.math.BigInteger; public class A{ public static void main(String[] args){ Reader reader = new Reader(System.in)...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
eb0cf54f489225faa9974d21fba7da71
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.InputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; import java.math.BigInteger; public class A{ public static void main(String[] args){ Reader reader = new Reader(System.in)...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
20108454372611b38bb6519a9cd9c16f
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.InputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; import java.math.BigInteger; public class A{ public static void main(String[] args){ Reader reader = new Reader(System.in)...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
310073f2b20a6b6d73277faed1a1baf8
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.util.Scanner; public class ExtractNumbers { public static void main(String[] args) { Scanner in = new Scanner(System.in); String str = in.nextLine(); StringBuilder sub = new StringBuilder(""); StringBuilder a = new StringBuilder(""); StringBuilder b = new StringBuilder(""); for (int i = 0; i < ...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
7195c5fb9c8d96d9b39dfcbffcb3dc1b
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Solution { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder s = new StringBuilder(br.readLine()); s.appe...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
6f16932e06a1dbf26e0286cdc620e701
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
/* DISCLAIMER : THIS IS THE WORST CODE WRITTEN BY ME , I REGRET IT COMPLETELY. I WAS VERY FRUSTRATED WHEN I TYPED THIS SHIT , SO PLEASE FORGIVE ME. */ import java.util.*; import java.io.*; import java.math.BigInteger; public class ExtractNumbers { static boolean isNumeric(String str) { try { BigInteger...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
9f0aa454d22287ac5f4e398f27705523
train_001.jsonl
1448636400
You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;1a;0": "aba", "123", "1a", "0". A word can be empty: for example, the string s=";;" contains three empty words separated by ';'.You sh...
256 megabytes
/* public class ExtractNumbers { } */ import java.util.*; import java.io.*; import java.math.BigInteger; public class ExtractNumbers { static boolean isNumeric(String str) { try { BigInteger a = new BigInteger(str); if(str.length()>1 && str.startsWith("0")) return false; else return true;...
Java
["aba,123;1a;0", "1;;01,a0,", "1", "a"]
2 seconds
["\"123,0\"\n\"aba,1a\"", "\"1\"\n\",01,a0,\"", "\"1\"\n-", "-\n\"a\""]
NoteIn the second example the string s contains five words: "1", "", "01", "a0", "".
Java 7
standard input
[ "implementation", "strings" ]
ad02cead427d0765eb642203d13d3b99
The only line of input contains the string s (1 ≤ |s| ≤ 105). The string contains only symbols '.' (ASCII 46), ',' (ASCII 44), ';' (ASCII 59), digits, lowercase and uppercase latin letters.
1,600
Print the string a to the first line and string b to the second line. Each string should be surrounded by quotes (ASCII 34). If there are no words that are numbers print dash (ASCII 45) on the first line. If all words are numbers print dash on the second line.
standard output
PASSED
326280dedadeff8522ad81ea5a2376dc
train_001.jsonl
1350370800
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to do it in two stages.The first stage is to merge the two decks in such a way that the relative order of...
256 megabytes
import static java.util.Arrays.deepToString; import java.io.*; import java.math.*; import java.util.*; public class D { static int[][] startFromColor(int n, int m, int[] a, int[] b, int color) { int[] arr = new int[n + m], c = new int[n + m]; int pa = 0, pb = 0; while (pa < n || pb < m) { boolean done = fa...
Java
["3\n1 0 1\n4\n1 1 1 1", "5\n1 1 1 1 1\n5\n0 1 0 1 0"]
2 seconds
["1 4 5 6 7 2 3\n3\n5 6 7", "6 1 2 3 4 5 7 8 9 10\n4\n1 7 8 9"]
null
Java 7
input.txt
[ "constructive algorithms", "greedy" ]
f1a312a21d600cf9cfff4afeca9097dc
The first input line contains a single integer n — the number of cards in the first deck (1 ≤ n ≤ 105). The second input line contains n integers, separated by single spaces a1, a2, ..., an (0 ≤ ai ≤ 1). Value ai equals 0, if the i-th card is lying face down, and 1, if the card is lying face up. The cards are given in ...
2,000
In the first line print n + m space-separated integers — the numbers of the cards in the order, in which they will lie after the first stage. List the cards from top to bottom. The cards from the first deck should match their indexes from 1 to n in the order from top to bottom. The cards from the second deck should mat...
output.txt
PASSED
b5adf5231797c25740ae371206d1ee35
train_001.jsonl
1350370800
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to do it in two stages.The first stage is to merge the two decks in such a way that the relative order of...
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.*; p...
Java
["3\n1 0 1\n4\n1 1 1 1", "5\n1 1 1 1 1\n5\n0 1 0 1 0"]
2 seconds
["1 4 5 6 7 2 3\n3\n5 6 7", "6 1 2 3 4 5 7 8 9 10\n4\n1 7 8 9"]
null
Java 7
input.txt
[ "constructive algorithms", "greedy" ]
f1a312a21d600cf9cfff4afeca9097dc
The first input line contains a single integer n — the number of cards in the first deck (1 ≤ n ≤ 105). The second input line contains n integers, separated by single spaces a1, a2, ..., an (0 ≤ ai ≤ 1). Value ai equals 0, if the i-th card is lying face down, and 1, if the card is lying face up. The cards are given in ...
2,000
In the first line print n + m space-separated integers — the numbers of the cards in the order, in which they will lie after the first stage. List the cards from top to bottom. The cards from the first deck should match their indexes from 1 to n in the order from top to bottom. The cards from the second deck should mat...
output.txt
PASSED
c7c4bde00bbe2d375b4519dee2d7e873
train_001.jsonl
1350370800
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to do it in two stages.The first stage is to merge the two decks in such a way that the relative order of...
256 megabytes
import java.io.*; import java.util.*; public class ACMICPC { FastScanner in; PrintWriter out; void solve() { int n = in.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = in.nextInt(); int m = in.nextInt(); int[] b = new int[m]; for (int i = 0; i < m; i++) b[i] = in.nextInt(); ...
Java
["3\n1 0 1\n4\n1 1 1 1", "5\n1 1 1 1 1\n5\n0 1 0 1 0"]
2 seconds
["1 4 5 6 7 2 3\n3\n5 6 7", "6 1 2 3 4 5 7 8 9 10\n4\n1 7 8 9"]
null
Java 7
input.txt
[ "constructive algorithms", "greedy" ]
f1a312a21d600cf9cfff4afeca9097dc
The first input line contains a single integer n — the number of cards in the first deck (1 ≤ n ≤ 105). The second input line contains n integers, separated by single spaces a1, a2, ..., an (0 ≤ ai ≤ 1). Value ai equals 0, if the i-th card is lying face down, and 1, if the card is lying face up. The cards are given in ...
2,000
In the first line print n + m space-separated integers — the numbers of the cards in the order, in which they will lie after the first stage. List the cards from top to bottom. The cards from the first deck should match their indexes from 1 to n in the order from top to bottom. The cards from the second deck should mat...
output.txt
PASSED
24955c6586bb762cfe3df0add842d3e7
train_001.jsonl
1350370800
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to do it in two stages.The first stage is to merge the two decks in such a way that the relative order of...
256 megabytes
import java.util.List; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.ArrayList; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.FileInputStream; import java....
Java
["3\n1 0 1\n4\n1 1 1 1", "5\n1 1 1 1 1\n5\n0 1 0 1 0"]
2 seconds
["1 4 5 6 7 2 3\n3\n5 6 7", "6 1 2 3 4 5 7 8 9 10\n4\n1 7 8 9"]
null
Java 7
input.txt
[ "constructive algorithms", "greedy" ]
f1a312a21d600cf9cfff4afeca9097dc
The first input line contains a single integer n — the number of cards in the first deck (1 ≤ n ≤ 105). The second input line contains n integers, separated by single spaces a1, a2, ..., an (0 ≤ ai ≤ 1). Value ai equals 0, if the i-th card is lying face down, and 1, if the card is lying face up. The cards are given in ...
2,000
In the first line print n + m space-separated integers — the numbers of the cards in the order, in which they will lie after the first stage. List the cards from top to bottom. The cards from the first deck should match their indexes from 1 to n in the order from top to bottom. The cards from the second deck should mat...
output.txt
PASSED
569b4540a17c80041ec024b867808dc6
train_001.jsonl
1350370800
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to do it in two stages.The first stage is to merge the two decks in such a way that the relative order of...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.StringTokenizer; public class D { BufferedReader in; StringTokenizer str; PrintWriter out; String SK; String next() throws IOException { while ((str == null) || (!str.hasMoreTokens())) { SK = in.readLine(); if (SK == null) return null; ...
Java
["3\n1 0 1\n4\n1 1 1 1", "5\n1 1 1 1 1\n5\n0 1 0 1 0"]
2 seconds
["1 4 5 6 7 2 3\n3\n5 6 7", "6 1 2 3 4 5 7 8 9 10\n4\n1 7 8 9"]
null
Java 7
input.txt
[ "constructive algorithms", "greedy" ]
f1a312a21d600cf9cfff4afeca9097dc
The first input line contains a single integer n — the number of cards in the first deck (1 ≤ n ≤ 105). The second input line contains n integers, separated by single spaces a1, a2, ..., an (0 ≤ ai ≤ 1). Value ai equals 0, if the i-th card is lying face down, and 1, if the card is lying face up. The cards are given in ...
2,000
In the first line print n + m space-separated integers — the numbers of the cards in the order, in which they will lie after the first stage. List the cards from top to bottom. The cards from the first deck should match their indexes from 1 to n in the order from top to bottom. The cards from the second deck should mat...
output.txt
PASSED
493ecbe2da3a4b0d3ab54b18bb596435
train_001.jsonl
1350370800
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to do it in two stages.The first stage is to merge the two decks in such a way that the relative order of...
256 megabytes
import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class ProblemD { public static void main(String[] args) throws IOException { // Scanner in = new S...
Java
["3\n1 0 1\n4\n1 1 1 1", "5\n1 1 1 1 1\n5\n0 1 0 1 0"]
2 seconds
["1 4 5 6 7 2 3\n3\n5 6 7", "6 1 2 3 4 5 7 8 9 10\n4\n1 7 8 9"]
null
Java 7
input.txt
[ "constructive algorithms", "greedy" ]
f1a312a21d600cf9cfff4afeca9097dc
The first input line contains a single integer n — the number of cards in the first deck (1 ≤ n ≤ 105). The second input line contains n integers, separated by single spaces a1, a2, ..., an (0 ≤ ai ≤ 1). Value ai equals 0, if the i-th card is lying face down, and 1, if the card is lying face up. The cards are given in ...
2,000
In the first line print n + m space-separated integers — the numbers of the cards in the order, in which they will lie after the first stage. List the cards from top to bottom. The cards from the first deck should match their indexes from 1 to n in the order from top to bottom. The cards from the second deck should mat...
output.txt
PASSED
33a08cdb4cc7918abae723625e6b6be2
train_001.jsonl
1350370800
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to do it in two stages.The first stage is to merge the two decks in such a way that the relative order of...
256 megabytes
import java.io.*; import java.util.*; public class D { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; void solve() throws IOException { int n = nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = nextInt(); int m = nextInt(); int[] b = new int[m]; for (int i ...
Java
["3\n1 0 1\n4\n1 1 1 1", "5\n1 1 1 1 1\n5\n0 1 0 1 0"]
2 seconds
["1 4 5 6 7 2 3\n3\n5 6 7", "6 1 2 3 4 5 7 8 9 10\n4\n1 7 8 9"]
null
Java 7
input.txt
[ "constructive algorithms", "greedy" ]
f1a312a21d600cf9cfff4afeca9097dc
The first input line contains a single integer n — the number of cards in the first deck (1 ≤ n ≤ 105). The second input line contains n integers, separated by single spaces a1, a2, ..., an (0 ≤ ai ≤ 1). Value ai equals 0, if the i-th card is lying face down, and 1, if the card is lying face up. The cards are given in ...
2,000
In the first line print n + m space-separated integers — the numbers of the cards in the order, in which they will lie after the first stage. List the cards from top to bottom. The cards from the first deck should match their indexes from 1 to n in the order from top to bottom. The cards from the second deck should mat...
output.txt
PASSED
787f10a1ebfe68a6972a2543a061a71f
train_001.jsonl
1350370800
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to do it in two stages.The first stage is to merge the two decks in such a way that the relative order of...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class H implements Runnable { private InputReader in; private PrintWriter out; public static void main(String[] args) { new H().run(); } public H() { //in = new InputReader(System.in); out = new PrintWriter(System.out); try {in =...
Java
["3\n1 0 1\n4\n1 1 1 1", "5\n1 1 1 1 1\n5\n0 1 0 1 0"]
2 seconds
["1 4 5 6 7 2 3\n3\n5 6 7", "6 1 2 3 4 5 7 8 9 10\n4\n1 7 8 9"]
null
Java 7
input.txt
[ "constructive algorithms", "greedy" ]
f1a312a21d600cf9cfff4afeca9097dc
The first input line contains a single integer n — the number of cards in the first deck (1 ≤ n ≤ 105). The second input line contains n integers, separated by single spaces a1, a2, ..., an (0 ≤ ai ≤ 1). Value ai equals 0, if the i-th card is lying face down, and 1, if the card is lying face up. The cards are given in ...
2,000
In the first line print n + m space-separated integers — the numbers of the cards in the order, in which they will lie after the first stage. List the cards from top to bottom. The cards from the first deck should match their indexes from 1 to n in the order from top to bottom. The cards from the second deck should mat...
output.txt
PASSED
275d8376278d6d8d708583379a6db964
train_001.jsonl
1350370800
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to do it in two stages.The first stage is to merge the two decks in such a way that the relative order of...
256 megabytes
import java.io.IOException; import java.util.InputMismatchException; import java.util.ArrayList; import java.io.OutputStream; import java.io.FileOutputStream; import java.io.PrintWriter; import java.io.FileInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @...
Java
["3\n1 0 1\n4\n1 1 1 1", "5\n1 1 1 1 1\n5\n0 1 0 1 0"]
2 seconds
["1 4 5 6 7 2 3\n3\n5 6 7", "6 1 2 3 4 5 7 8 9 10\n4\n1 7 8 9"]
null
Java 7
input.txt
[ "constructive algorithms", "greedy" ]
f1a312a21d600cf9cfff4afeca9097dc
The first input line contains a single integer n — the number of cards in the first deck (1 ≤ n ≤ 105). The second input line contains n integers, separated by single spaces a1, a2, ..., an (0 ≤ ai ≤ 1). Value ai equals 0, if the i-th card is lying face down, and 1, if the card is lying face up. The cards are given in ...
2,000
In the first line print n + m space-separated integers — the numbers of the cards in the order, in which they will lie after the first stage. List the cards from top to bottom. The cards from the first deck should match their indexes from 1 to n in the order from top to bottom. The cards from the second deck should mat...
output.txt
PASSED
872164858e48cd45a04b49755fbfc4a6
train_001.jsonl
1350370800
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to do it in two stages.The first stage is to merge the two decks in such a way that the relative order of...
256 megabytes
/* Codeforces Template */ import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.fill; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { static long initTime; static final Random rnd = new Random(7777L); static boo...
Java
["3\n1 0 1\n4\n1 1 1 1", "5\n1 1 1 1 1\n5\n0 1 0 1 0"]
2 seconds
["1 4 5 6 7 2 3\n3\n5 6 7", "6 1 2 3 4 5 7 8 9 10\n4\n1 7 8 9"]
null
Java 7
input.txt
[ "constructive algorithms", "greedy" ]
f1a312a21d600cf9cfff4afeca9097dc
The first input line contains a single integer n — the number of cards in the first deck (1 ≤ n ≤ 105). The second input line contains n integers, separated by single spaces a1, a2, ..., an (0 ≤ ai ≤ 1). Value ai equals 0, if the i-th card is lying face down, and 1, if the card is lying face up. The cards are given in ...
2,000
In the first line print n + m space-separated integers — the numbers of the cards in the order, in which they will lie after the first stage. List the cards from top to bottom. The cards from the first deck should match their indexes from 1 to n in the order from top to bottom. The cards from the second deck should mat...
output.txt
PASSED
417460457f05f964e50e71ccd3c0929e
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.util.*; public class GoodWork { static Scanner in =new Scanner(System.in); public static void main(String[] args) { int n=in.nextInt(); boolean B=false; int a[]=new int[n]; for(int i=0;i<n;i++){ a[i]=in.nextInt(); if(a[i]!=1)B=true; } Arrays.sort(a...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
209f1aaef8363057644188cc71b5faa3
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static Scanner sc=new Scanner(System.in); static PrintWriter out=new PrintWriter(System.out); //Main public static void main(String args[]) { int test=1; //test=sc.nextInt(); while(test-->0) { int n=sc.nextInt(),a[]=new int[n]; for(int i=0;i<...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
5ee4ab4b1f2c853f1c8bf2515c50276f
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.*; public class Main { public static InputReader in; public static PrintWriter pw; ...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
7985f60d60f8f629147ed6e2659a3be3
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main1 { static class Reader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} public int read() {if (n...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
fe0848e9273e096c2bbadeb4a005f0bd
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class CF{public static void main(String[] args){S s=new S();s.s();s.output();}}class S{ void s() { int n = NI(); int[] a = new int[n]; inInt(a, n); Arrays.sort(a...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 8
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
59fede579b56759242d3cc91535b6424
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author lpeter83 ...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
f0215c6dcddf437e00fe33eab7a4e7cc
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class C { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null; private void soluti...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
c6c638ee39ccbf400d5431cd4fb2ce63
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class C { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null; private void soluti...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
95e320323fc97bf03843071d74d9a779
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Algs { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] src = new int[n]; for (int i = 0; i < n; i++) { src[i] = in.nextInt(); } Arra...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
e5b94b03fb0abb0d9e9606467df61364
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.*; import java.util.*; public class R97D2T136C { public void solve() throws IOException { int n = nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } Arrays.sort(a); if (a[n-1] > 1) a[n-1]...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
d943f19f01338a06800ba9bf0e69d315
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public BufferedReader input; public PrintWriter output; pu...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
508c0cd83c88806e94bc5fa00ac2f3c0
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class sample { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; boolean allone = true; for (int i = 0; i < n; i++) { a[i] = in.nextInt(); if (allone && a[i] != 1) all...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
a27a8dcc279a8f4291b8fd8a8da3ecd7
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class TaskF { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; a[0] = in.nextInt(); int m = 0; int max = a[m]; for (int i = 1; ...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
7359dfa6094cd9291abd824482fa1d28
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.util.*; public class c { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; boolean ff = true; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); if (a[i] != 1) { ff = false; } } Arrays.sort(a); for (int...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
c2dbebc127f646ac377ab2a4b618e24d
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Scanner; import java.lang.*; import java.lang.reflect.Array; public class test { public static void main(String[] args) throws Exception { int n = nextInt(); int[] a = new int[n]; for(int i = 0; i < n; i++){ ...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
984282cd4fcd8ba11791b8591062d451
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Solution { public static final String INPUT_FILE = "a.in"; public static final String OUTPUT_FILE = "a.out"; BufferedReader bf; StringTokenizer st; public String next() throws IOException { if (st == null || !st.hasMo...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
84e2acfcb9b9471dd1db7fdf04190d1d
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.util.Arrays; import java.util.Scanner; /** * Replacement * * Little Petya very much likes arrays consisting of n integers, where each of * them is in the range from 1 to 10^9, inclusive. Recently he has received one * such array as a gift from his mother. Petya didn't like it at once. He * decide...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
2fc589a21ac86cf5b4dd92fa545ca36e
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; public class Main { private BufferedReader input; private PrintWriter output; private StringTokenizer stoken; String fin = "input"; String fout = "output"; private void solve() throws IOException { ...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
fabc75abc0c088c39b0a1c36521b9523
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.util.Arrays; import java.util.Scanner; /** * * @author Inquisiter */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner in = new Scanner(System.in); int n = in...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
38799c8701cce5cabafb2518b957ccb9
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class TaskC { /** * @param args */ public static void main(String[] args) { TaskC task = new TaskC(); task.read(); task.write(); } int n; ArrayLi...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
5da47747a0b86e996a533d1b6a062eae
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.util.Arrays; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author codeKNIGHT */ public class Main { public static void main(String[] args) {...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output
PASSED
8e9998295d79ad8d65c65e2e3537ea0f
train_001.jsonl
1323443100
Little Petya very much likes arrays consisting of n integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. He decided to choose exactly one element from the array and replace it with another integer that als...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.lang.reflect.Array; import ja...
Java
["5\n1 2 3 4 5", "5\n2 3 4 5 6", "3\n2 2 2"]
2 seconds
["1 1 2 3 4", "1 2 3 4 5", "1 2 2"]
null
Java 6
standard input
[ "implementation", "sortings", "greedy" ]
1cd10f01347d869be38c08ad64266870
The first line contains a single integer n (1 ≤ n ≤ 105), which represents how many numbers the array has. The next line contains n space-separated integers — the array's description. All elements of the array lie in the range from 1 to 109, inclusive.
1,300
Print n space-separated integers — the minimum possible values of each array element after one replacement and the sorting are performed.
standard output