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
a86e788925908556fd8873405496ae27
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args){ Scanner input = new Scanner(System.in); int n = input.nextInt(); int m = input.nextInt(); int a[] = new int[n]; long sum=0; for (int i = 0; i < n; i++) { a[i] = input...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
0062dde7e94165137d997bc8078ece50
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class Japanese_crossword { public static void main(String a[]){ Scanner s = new Scanner(System.in); int n = s.nextInt(); long x = s.nextLong(); int[] arr = new int[n]; for(int i=0;i<n;i++){ arr[i] = s.nextInt(); } if(arr.length==1 && arr[0]==x){ System.out.println("YES...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
e71ac66f7bddd16e1f09ef8c0058a15d
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class Japanese_crossword { public static void main(String a[]){ Scanner s = new Scanner(System.in); int n = s.nextInt(); long x = s.nextLong(); int[] arr = new int[n]; for(int i=0;i<n;i++){ arr[i] = s.nextInt(); } if(arr.length==1 && arr[0]==x){ System.out.println("YES...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
35078570d5ccf529216d90971272c592
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in; in = new Scanner(System.in); int n, x; n = in.nextInt(); x = in.nextInt(); int tot = 0; for(int i=1; i<=n; i++) { int u; u = in.nextInt(); tot += u; ...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
4df14c4a36f5db5692b7e7483694829d
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int n = scan.nextInt(), x = scan.nextInt(); int[] arr = new int[n]; int i; int sum = 0; for(i = 0 ; i < n ; i++) { arr[i] = scan.nextInt();...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
b62699f494fd9dacbae7c6e101c5d1b3
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
d0c26ed2d123969a7380454b9ca8cafd
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class cf31 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line; line ...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
f254ea2c7d8c148813f38efa68bc52de
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.*; import java.util.*; public class EdThreeOneB{ public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int n = sc.nextInt(); int x = sc.nextInt(); int sum =0; for(int i =0...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
491d8877b67946c26831d641a625580b
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; import java.io.*; public class a{ public static void main(String [] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int x=sc.nextInt(); int sum=0; for(int i=0;i<n;i++){ sum+=sc.nextInt(); } if((sum+(n-1))==x){ System.out...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
5202f50e5f7e127d9c29129187dcc13f
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.*; import java.util.*; import java.util.Map.Entry; import java.lang.Math; import java.math.BigInteger; public class Problem { class Pair { int x, y; Pair(int x, int y) { this.x = x; this.y = y; } } void solve() throws IOException { int n = rI(); long x = rL(); long sum = 0; for(...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
86a91ed8f78bb2f7b48aeed223e90751
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class B884{ public static void main(String[] args){ Scanner scan=new Scanner(System.in); int num=scan.nextInt(),len=scan.nextInt(),sum=0; for(int i=0;i<num;i++) sum += scan.nextInt(); System.out.print(sum+num-1==len?"YES":"NO"); } }
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
76a58928aada148daee63d0d51edee01
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.*; public class _884B { static PrintWriter out = new PrintWriter(System.out); static Scan in = new Scan(); public static void main(String[] args) throws IOException { int n = in.nextInt(), x = in.nextInt(), sum = 0; for (int i = 0; i < n; i++) { sum += in.nextIn...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
f1912ab7beb8342b46c420793c6df045
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Created by sahil on 31/10/17. */ public class Main { public static void main(String[] arg){ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); try { String pa...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
1268c85708bbbb8f023bc58d860ed021
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Scanner; /** * Created by камиль on 06.11.2017. */ public class B { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int x = in.nextInt(); int a[] = new int[n]; int sum = 0; for (int i = 0; i < n...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
29f015fb8f4ba45b3b814377d62a831b
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc=new Sc...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
96aeb8f338bb0e0d60516f751dd23e2d
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Summer { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); Reader input = new Reader(); long n,x,a,res = 0; n = input.l(); x = input.l(); for(int i = 1;i <= n;i ++){ a= input.l(); res += a...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
921efbe560fe92d8d6836aa71dd5b43c
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
// δ½œθ€…οΌšζ¨ζˆη‘žε…ˆη”Ÿ import java.io.*; import java.util.*; public class cfe31b { static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokeniz...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
f0bf77d3cbb37167994a690b19facf3b
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class codeforces2 { private static Scanner sc = new Scanner(System.in); public static void main(String args[]) { int n=sc.nextInt(),x=sc.nextInt(),sum=0; int arr[]=new int[n]; for (int i = 0; i < n; i++) { arr[i]=sc.nextInt(); sum+=a...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
c6526f0df1824520e1b8ad739a3a9acc
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class B { static public void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int x = in.nextInt(); int[] a = new int[n]; long sum = 0; for(int i=0;i<n;i++) { a[i] = in.nextInt(); x-= a[i]; } if(x==n-1) { System.out.print("YES"); ...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
98517e4748f44be1c4596fdb39fdd7c0
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(System.out); //Scanner sc = new Scanner(); Reader in = new Reader(); Main solver = new Main(); solver....
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
8235d6df09eb1284c780a808522d9813
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class B{ public static void main(String[] args){ Scanner sb = new Scanner(System.in); int n, x; n = sb.nextInt(); x = sb.nextInt(); int total_ones = 0; int minimum_zeros = n-1; for(int i = 0; i < n; i++){ total_ones += sb.nextInt(); } if(total_ones...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
4b209941989a990b4a7f83eab6304e98
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Scanner; public class second { public static void main(String[] args){ Scanner input = new Scanner(System.in); int n = input.nextInt(); long x = input.nextLong(); int[] arr; long sum = 0; arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = input.nextInt(); sum += arr[i]; }...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
d0df0543416f4e60625a75cca3130bd5
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; //public class edu11{ //static variable static final int mod = (int) 1e9 + 7; static final double eps = 1e-6; static final double pi = Math.PI; static final long inf = Long.MAX_VALUE / 2; // .......static class static class Pair{ ...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
479a602be9e398e241d5a560f75d598a
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Scanner; public class Ssss { static Scanner read=new Scanner(System.in); public static void main(String[] args) { int n=read.nextInt(); int x=read.nextInt(); int[] t=new int[n]; int a=0; for(int i=0;i<n;i++){ t[i]=read.nextInt(); a=a+t[i]; } if (x==a+n-1) System.out.println("YES"); else Syste...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
696717f93a045650cd511dbfc33d09a9
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Scanner; public class Ssss { static Scanner read=new Scanner(System.in); public static void main(String[] args) { int n=read.nextInt(); int x=read.nextInt(); int a=0; for(int i=0;i<n;i++){ a=a+read.nextInt(); } if (x==a+n-1) System.out.println("YES"); else System.out.println("NO"); } }
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
b2daa31637de0848521a43dd367b714d
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
/** * Date: 24 Jun, 2018 * Link: * * @author Prasad-Chaudhari * @email prasadc8897@gmail.com */ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class newProgram { public static void main(St...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
7d81001a863925db2e8b34c124b1cb9a
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.*; public class Main { public s...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
2c8c439acaeab858bd47afdb50fd814e
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.*; import java.util.*; public class Prog { public static void main(String[] args) throws Exception { //FileInputStream inputStream = new FileInputStream("input.txt"); //FileOutputStream outputStream = new FileOutputStream("output.txt"); InputStream inputStream = System.in; OutputStream out...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
e41a47c47ac325fd04f7372c87958a28
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class comp { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int size = scan.nextInt(); for(int i = 0; i < n; i++) { size -= scan.nextInt(); } System.out.println((size-(n-1) == 0)?"YES":"NO"); } }...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
a77545b4312085077ff8c180a7bc3013
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class B { public static void main(String[] arg...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
912f65435b1291990380da8d42722c0a
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class tree { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int x = scanner.nextInt(); int [] a = new int[n]; for (int i = 0; i <n ; i++) { a[i] = scanner.nextInt(); ...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
ee654a0ea6fc9eaad60ad9d29562c3f8
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
/* * @author romit17 */ import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class B884 { void solve() throws IOException { PrintWriter out = new PrintWriter(System.out); StringBuilder s...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
6303489e47a19f769f42d95385cf0327
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Scanner; /** * * @author rreza */ public class JavaApplication4 { /** * @param args the command line arguments */ static Scanner in = new Scanner(System.in); public static void main(String[] args) { String temp = in.nextLine(); String[] temp1 = temp.split("...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
cf7b92a613cbc4951dba782da8e479b0
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Scanner; public class Main { private static Scanner sc = new Scanner(new InputStreamReader(System.in)); private static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); pub...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
1104384f3f6d60b5afeed3bc1cd599d7
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Jenish */ public class Ma...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
ddbd3eac24c780477b8b09ef803e000f
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class q2 { static class Scan { private final InputStream inputStream; private final byte[] buffer = new byte[1024]; private int currentChar; private int numChars; private SpaceCharFilter filter; public Scan () { ...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
a4bdf11bf4414daa21e77fd86a984ed6
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; import java.io.*; public class programA { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int t = Integer....
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
3bf01d37bb7ce3e0fe7ecdfdb0a46223
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Scanner; public final class CrossWordCF { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int x=sc.nextInt(); int sum=0; for(int i=0;i<n;i++){ sum+=sc.nextInt(); } sum+=(n-1); ...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
08eb8f93fdce87d4ad4e345b557aa080
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class he { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n = cin.nextInt(), k = cin.nextInt(); int a[] = new int [n]; int sum = 0; for(int i = 0; i < n; i++) { a[i] = cin.nextInt(); sum += a[i]; } if(n =...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
0b12b6f1c25f890004723b880175c09e
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.*; public class JapaneseCrosswordsStrikeBack{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int n=in.nextInt(); int x=in.nextInt(); int k=0; for(int i=0;i<n;i++){ k+=in.nextInt(); } if(x==k+n-1){ ...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
016cd60d8ccd7ea70ee31329970a6ad0
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(), x = sc.nextInt(); int sum = 0; for(int i = 0; i< n; i++) sum += sc.nextInt(); if(sum == (x-n+1)) { System.out.println("YES")...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
63648741ac7ee76b13b424ab4e9973f6
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.util.Scanner; public class divs { public static void main(String[] args) { Scanner in = new Scanner(System.in); int nelements = in.nextInt(); int length = in.nextInt(); int[] arr = new int[nelements]; for (int i = 0; i < nelements; i++){ arr[i] = in...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
9590bb366149229e766198317016b87f
train_000.jsonl
1509113100
A one-dimensional Japanese crossword can be represented as a binary string of length x. An encoding of this crossword is an array a of size n, where n is the number of segments formed completely of 1's, and ai is the length of i-th segment. No two segments touch or intersect.For example: If x = 6 and the crossword is...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in...
Java
["2 4\n1 3", "3 10\n3 3 2", "2 10\n1 3"]
1 second
["NO", "YES", "NO"]
null
Java 8
standard input
[ "implementation" ]
080a3458eaea4903da7fa4cf531beba2
The first line contains two integer numbers n and x (1 ≀ n ≀ 100000, 1 ≀ x ≀ 109) β€” the number of elements in the encoding and the length of the crossword Mishka picked. The second line contains n integer numbers a1, a2, ..., an (1 ≀ ai ≀ 10000) β€” the encoding.
1,100
Print YES if there exists exaclty one crossword with chosen length and encoding. Otherwise, print NO.
standard output
PASSED
0d73107e6c89c3e47547224d22046758
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner input = new Scanner( System.in ); int n = input.nextInt(); String way = input.next(); int firstR = way.indexOf( 'R' ) + 1, firstL = way.indexOf( 'L' )...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
78da0332f97be06f6e8a2607613fb237
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Map.Entry; import java.util.Set; import java.util.TreeSet; public class Main { public static void main(String...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
9ea41ed702670398f0ba4641c213ad2c
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class A { public static void main(String[] args) throws IOException { //Scanner in = new Scanner (System.in); InputStreamReader reader = new InputStreamReader(Sys...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
583a63ee35f24e131872e2fa69bd69df
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
//package com.congli.codeforces; import java.io.*; import java.util.*; public class C180Div2A_SnowFootprints { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args) { C180Div2A_SnowFootprints test = new C180Div2A_SnowFootprints(); test.star...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
f9e6a1a89ce4181373cea3b749c6b624
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class A { private static final boolean DEBUG = !"true".equalsIgnoreCase(System.getProperty("ONLINE_JUDGE")); private static final boolean DEBUG_OUT = true; private final String inFile = getClass().getName() + ".in"; private final String outFil...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
fd050075ae8385ec79ba5f40a642943a
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class CF289A { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); //READ---------------------------------------------------- int n = sc.nextIn...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
db61750488fe6d4cf1d3b7554a805c7b
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class FootPrints { public static void main (String[]args) throws IOException { BufferedReader rdr = new BufferedReader(new InputStreamReader(System.in)); String line = rdr.readLine(); int n...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
411fa1fcc91d762479a468fc39d3c380
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
//package Round_180; import java.util.*; import java.io.*; import static java.lang.Math.*; public class A { void solve () throws IOException { int n = in.nextInt(); char c[] = in.next().toCharArray(); for (int i = 0; i<c.length-1; i++){ ...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
787c410d17712e175d41f9cfe5fd3692
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.util.*; import java.util.ArrayList; import java.io.*; public class Main{ public static void main(String[] args){ Scanner cin = new Scanner(System.in); int n = cin.nextInt(); String str = cin.next(); int l = -1, r = -1; for (int i = 0; i < str.length(); i++) if(str.charAt(i) == 'L'){ l = i...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
32e60c00dcee085dfd8cd59825561727
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import static java.util.Arrays.deepToString; import java.io.*; import java.math.*; import java.util.*; public class Main { static void solve() throws IOException { int n = nextInt(); int[] array = new int[n]; String s = reader.readLine(); int r = 0; int l = 0; for ...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
9b81142aec8a89aa6818fe777d5f23bd
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author alex */ pub...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
4bb0ce5422dbd00354ef9d1449764065
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
a656a6c870aff4445c38b044112e263c
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
// @author Sanzhar import java.io.*; import java.util.*; import java.awt.Point; public class Template { BufferedReader in; PrintWriter out; StringTokenizer st; String next() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(in.readLine())...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
b81c50a02b5b32c075f11e0752e1f882
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.util.*; public class Main{ public static String path(String n){ int start = 0; int countR = 0; int countL = 0; for(int i=0; i<n.length(); i++){ if(n.charAt(i) == '.') start++; if(n.charAt(i) == 'R' || n.charAt(i) == 'L') break; } if(n.length()>...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
ab4b3495b9508abc0480404ecc7e0d64
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.util.Scanner; /** * Created by tdph5945 on 2016-06-27. */ public class SnowFootprints { public static void main(String... args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); String line = scanner.next(); int first = -1, last = -1, misMatch = -...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
a1f2d99bccf38af5339a489238d302a0
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class CodeforcesRound180Div2 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String a = br.readLine(); int n = Integer.pa...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
ea86ac2844196bd3769c53b1541b6fe0
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.mat...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
bfba9b8226cb008fd22d0dd398f808e0
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class SnowFootprints { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader input = new BufferedReader(new InputStreamReader( System.in)); int t = Integer.parse...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
7c2a5967613ad417e1d07d7bfddd8bc5
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.*; import java.util.*; public class z3 { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); int n=in.nextInt(); in.nextLine(); String s=in.nextLine(); char c; int minR=10000; int maxR=0; int minL=10000; int maxL=0; int isR=0; int isL=0; ...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
498a37872d6020a8c13efc957fb68b95
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int x = Integer.parseInt(in.nextLine()); String cad = in.nextLine(); int pi = 0; int pf = 0; if (cad.contains("R")) { pi = cad.ind...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
eaf9b895caa1c385ab63fa854fd7b642
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
//package Div_180; //Xudo xoxlasa Accepted import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String s=sc.next(); int r=s.indexOf("R"); int l=s.indexOf("L"); if(r!=-1&&l!=-1){ System.out.println((r+1)+" "+l); }else...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
36843039b10fa8b1bc2e52daaf172969
train_000.jsonl
1366385400
There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (i + 1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (i - 1)-th block, he will leave a left footprint ...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A { static FastScanner in = new FastScanner(System.in); ...
Java
["9\n..RRLL...", "11\n.RRRLLLLL.."]
1 second
["3 4", "7 5"]
NoteThe first test sample is the one in the picture.
Java 7
standard input
[ "implementation", "greedy" ]
3053cba2426ebd113fcd70a9b026dad0
The first line of the input contains integer n (3 ≀ n ≀ 1000). The second line contains the description of the road β€” the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha...
1,300
Print two space-separated integers β€” the values of s and t. If there are several possible solutions you can print any of them.
standard output
PASSED
e1e86424be2e0e020ad7f45b6cdbbee6
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They do everything differently. They have a different alphabet so they have a different definition for a string.A Bitlandish string is a string made only of characters "0" and "1".BitHaval (the mayor of Bitland) loves to play with Bitlandish strings. He takes some Bitlandish stri...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class R173_DIV2_3 { static String origString = ""; static String modifiedString = ""; static MyScanner scanner = new MyScanner(); ...
Java
["11\n10", "1\n01", "000\n101"]
2 seconds
["YES", "NO", "NO"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "math" ]
113ae625e67c8ea5ab07be44c3b58a8f
The first line contains Bitlandish string a, the second line contains Bitlandish string b. The strings can have different lengths. It is guaranteed that the given strings only consist of characters "0" and "1". The strings are not empty, their length doesn't exceed 106.
1,500
Print "YES" if a can be transformed into b, otherwise print "NO". Please do not print the quotes.
standard output
PASSED
dd28ba19f8726ae62ecccbd9c52fac33
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They do everything differently. They have a different alphabet so they have a different definition for a string.A Bitlandish string is a string made only of characters "0" and "1".BitHaval (the mayor of Bitland) loves to play with Bitlandish strings. He takes some Bitlandish stri...
256 megabytes
import java.util.Scanner; public class Codeforces { static Scanner scanner; public static void main(String[] args) throws Exception { // TODO code application logic here scanner = new Scanner(System.in); String str; String str2; str = scanner.next(); ...
Java
["11\n10", "1\n01", "000\n101"]
2 seconds
["YES", "NO", "NO"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "math" ]
113ae625e67c8ea5ab07be44c3b58a8f
The first line contains Bitlandish string a, the second line contains Bitlandish string b. The strings can have different lengths. It is guaranteed that the given strings only consist of characters "0" and "1". The strings are not empty, their length doesn't exceed 106.
1,500
Print "YES" if a can be transformed into b, otherwise print "NO". Please do not print the quotes.
standard output
PASSED
f4170c471533e7b79b7f4843b14c81f6
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They do everything differently. They have a different alphabet so they have a different definition for a string.A Bitlandish string is a string made only of characters "0" and "1".BitHaval (the mayor of Bitland) loves to play with Bitlandish strings. He takes some Bitlandish stri...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class C { public static void main(String[] args) { InputReader in = new InputReader(System.in); String a = in.next(); String b...
Java
["11\n10", "1\n01", "000\n101"]
2 seconds
["YES", "NO", "NO"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "math" ]
113ae625e67c8ea5ab07be44c3b58a8f
The first line contains Bitlandish string a, the second line contains Bitlandish string b. The strings can have different lengths. It is guaranteed that the given strings only consist of characters "0" and "1". The strings are not empty, their length doesn't exceed 106.
1,500
Print "YES" if a can be transformed into b, otherwise print "NO". Please do not print the quotes.
standard output
PASSED
dec3d9cf333e3407a332fc206db902a9
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They do everything differently. They have a different alphabet so they have a different definition for a string.A Bitlandish string is a string made only of characters "0" and "1".BitHaval (the mayor of Bitland) loves to play with Bitlandish strings. He takes some Bitlandish stri...
256 megabytes
import java.io.BufferedInputStream; import java.util.Arrays; import java.util.Scanner; public class C282 { public static void main(String[] args) { Scanner scanner = new Scanner(new BufferedInputStream(System.in)); char[] first = scanner.next().toCharArray(); char[] second = scanner.next()....
Java
["11\n10", "1\n01", "000\n101"]
2 seconds
["YES", "NO", "NO"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "math" ]
113ae625e67c8ea5ab07be44c3b58a8f
The first line contains Bitlandish string a, the second line contains Bitlandish string b. The strings can have different lengths. It is guaranteed that the given strings only consist of characters "0" and "1". The strings are not empty, their length doesn't exceed 106.
1,500
Print "YES" if a can be transformed into b, otherwise print "NO". Please do not print the quotes.
standard output
PASSED
2ed5b0c13830dab41f6405630ab36979
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They do everything differently. They have a different alphabet so they have a different definition for a string.A Bitlandish string is a string made only of characters "0" and "1".BitHaval (the mayor of Bitland) loves to play with Bitlandish strings. He takes some Bitlandish stri...
256 megabytes
import java.util.*; import java.io.*; public class Task { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { String a = br.readLine(); String b = br.readLine(); if (a.equals(b)) { System.out.println("YES"); retur...
Java
["11\n10", "1\n01", "000\n101"]
2 seconds
["YES", "NO", "NO"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "math" ]
113ae625e67c8ea5ab07be44c3b58a8f
The first line contains Bitlandish string a, the second line contains Bitlandish string b. The strings can have different lengths. It is guaranteed that the given strings only consist of characters "0" and "1". The strings are not empty, their length doesn't exceed 106.
1,500
Print "YES" if a can be transformed into b, otherwise print "NO". Please do not print the quotes.
standard output
PASSED
150b092050f62b86c095fc744cde68df
train_000.jsonl
1363188600
The Bitlandians are quite weird people. They do everything differently. They have a different alphabet so they have a different definition for a string.A Bitlandish string is a string made only of characters "0" and "1".BitHaval (the mayor of Bitland) loves to play with Bitlandish strings. He takes some Bitlandish stri...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class XORandOR { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String a = br.readLine(); String b = br.readLine(); if...
Java
["11\n10", "1\n01", "000\n101"]
2 seconds
["YES", "NO", "NO"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "math" ]
113ae625e67c8ea5ab07be44c3b58a8f
The first line contains Bitlandish string a, the second line contains Bitlandish string b. The strings can have different lengths. It is guaranteed that the given strings only consist of characters "0" and "1". The strings are not empty, their length doesn't exceed 106.
1,500
Print "YES" if a can be transformed into b, otherwise print "NO". Please do not print the quotes.
standard output
PASSED
ef0567ab129c72df936a28cef46fc6f3
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; /* spar5h */ public class cf3 implements Runnable{ static class pair { int i; long w; pair(int i, long w) { this.i = i; this.w = w; } } static class comp implements Comparator<pair> ...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
9553c0f8358b921c56b375fd6c4e5180
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class B{ public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
92bd6d2f5638d931ff55c79af59a34ee
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
//package com.pb.codeforces.practice; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.TreeMap; public class CF1041C { public static class FastReader { BufferedReader br; StringTokenizer st;...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
92854debc5fa6c0ef0342073fc216a9c
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; public class wef { public static class FastReader { BufferedReader br; StringTokenizer st; //it reads the data about the specified poin...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
65ad6e8fc30c6d5c6887d92f0e6f9c3b
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; public class Main { static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public InputReader(InputStream st) { this...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
d1012a47899218e4164d6826668a0e7c
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { public static void main(String[] args) throws IOException { FastReader in = new FastReader(System.in); PrintWriter out = new PrintWriter(System.out); //FastReader in = new FastReader(new FileInputStre...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
c77b2761ffc9620e9fcf638dceaebcce
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * @author khokharnikunj8 */ public class Main { public static void main(String[] args) { ...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
ab5254a7a63bb8a8c4b6924e3cc3dac7
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
//package pro; import java.io.IOException; import java.util.*; public class Codechef2 { static FasterScanner in = new FasterScanner(); static class node{ long val; long co; node(long v, long c){ this.val=v; this.co=c; } } public static void main(String[] args) { int n = in.nextInt(); long m = in...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
0f3196242365dd88a592d4cdc1c71417
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.util.*; import java.io.*; public class Forces{ public static void main(String ...arg) { Read cin = new Read(); int n = cin.nextInt(); long m = cin.nextLong(); long d = cin.nextLong(); ArrayList<ArrayList<Long>> arr = new ArrayList<>(); for(int i=0;i<n;i++) { arr.add(new ArrayList<Long>...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
be88a985d08dd52a2e938132c1d01ad1
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.*; import java.util.*; public class cf509C{ public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int d = sc.nextInt(); int[] aa = new int[n]; TreeMap<Integer,Integer> tm = new TreeMap<Integer,Inte...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
44dc0bf31b1589f2cd9f6ab4d92e1b30
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.util.*; import java.lang.*; import java.lang.reflect.Array; import java.io.*; import java.math.*; import java.text.DecimalFormat; import java.util.Arrays; import java.util.Collections; public class Prac{ static class InputReader { private final InputStream stream; private final byte[]...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
acfe3158040d594c853a73ac8ade3e94
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class tG { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new ...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
a5cd22359f677bbb982ff67ec1e42e2c
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.util.*; public class a{ public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int m=in.nextInt(); int d=in.nextInt(); TreeSet<Integer> treeSet=new TreeSet<Integer>(); LinkedHashMap<Integer,Integer> hash=new LinkedHashMap<Integer,Integer>(); for(int...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
f9fb6b8fcff2f8152238b5aae6689b65
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class fast implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numCh...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
6d93036c0d852431fadbd20ecc493bc3
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long gcd(long a,long b) { //System.out.println("a "+a+" b "+b); if(b==0) { return a; } return gcd(b,a%b); } static void debug(Object... O) { System.out.println(Arrays.deepToString(O)); } static class Reader { final pr...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
3bbc21f26752777bd743662762768bac
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import javax.swing.event.TreeSelectionEvent; import java.io.DataInputStream; import java.io.IOException; import java.util.Arrays; import java.util.TreeMap; import java.util.TreeSet; public class Main { public static void main(String... args) throws IOException { Reader reader = new Reader(); int n...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
91be226d3bdd5f4229786f1e65ffebe3
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class CoffeeBreak implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; priva...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
86e9e577a0095f9fce9ef3a48550b30f
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class CoffeeBreak2 implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; priv...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
a2dce2fa64bc3729c9b6885dc64af653
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; import static java.lang.Integer.parseInt; import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { public stat...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
bb5a711ec24bb2cf5ebde227726044f2
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class C1041 { static char[] sarr; public static void main(String[] args) throws IOException { FastScanner fs=new FastScanner(); PrintWriter out = new PrintWriter(System.out); // int T = 1; // int T=fs.nextInt(); ...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
139172488d3e9e3068f66f6c9b05617d
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import java.util.HashMap; import java.util.PriorityQueue; public class templ implements Runnable { class pair { int f,s; pair(int fi,int se) { f=fi; s=se; } } public static int M=1000000007;...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
a754e5ea6a1d509edf477ac22b8e95ad
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; public class Solution { static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public InputR...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
93cb995adef8a0dd39b178a38d11f523
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Test { FastIO sc; static int n; static int[][] dp; static boolean check(boolean[] vis) { boolean r = false; for (boolean e : vis) { if (e) { r = true; break; ...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
f89055877141600b167b91e7483bf5a0
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import javax.swing.text.html.HTMLDocument; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StringReader; import java.math.BigInteger; import java.nio.Buffer; import java.util.*; public class Main { public static void main(String[] args){ try { ...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
353bc44e6d321e0e5e7fe0ecabd39efd
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.lang.*; import java.math.*; import java.util.*; import java.io.*; public class Main { class Node implements Comparable<Node>{ long id; long d; public Node(long id,long d){ this.id=id; this.d=d; } public int compareTo(Node c){ int t=Long.compare(this.d,c.d); ...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
eb7a745c613081ace2bdcdfc3b1c59d8
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.util.Comparator; public class test { static int n; static int m; static int d; static pair[] a; private static class pair implements Comparable<pair> { int n1; int n2; public pair(int n1, int ...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
d7bfff1771f21e92c05d849bab0da732
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
import java.io.*; import java.util.*; public class Main_Round509Div2_C { private static Scanner sc; private static Printer pr; private static void solve() { int n = sc.nextInt(); @SuppressWarnings("unused") int m = sc.nextInt(); int d = sc.nextInt(); List<Pair> a = new ArrayList<>(n); for (int i = 0...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
d691a2714e6293950eb5bf1a0192f7c1
train_000.jsonl
1537094100
Recently Monocarp got a job. His working day lasts exactly $$$m$$$ minutes. During work, Monocarp wants to drink coffee at certain moments: there are $$$n$$$ minutes $$$a_1, a_2, \dots, a_n$$$, when he is able and willing to take a coffee break (for the sake of simplicity let's consider that each coffee break lasts exa...
256 megabytes
// package Practice1.CF1041; import java.util.Arrays; import java.util.Scanner; import java.util.TreeMap; public class CF1041C { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int m = s.nextInt(); int d = s.nextInt(); int[]...
Java
["4 5 3\n3 5 1 2", "10 10 1\n10 5 7 4 6 3 2 1 9 8"]
2 seconds
["3\n3 1 1 2", "2\n2 1 1 2 2 1 2 1 1 2"]
NoteIn the first example, Monocarp can take two coffee breaks during the first day (during minutes $$$1$$$ and $$$5$$$, $$$3$$$ minutes will pass between these breaks). One break during the second day (at minute $$$2$$$), and one break during the third day (at minute $$$3$$$).In the second example, Monocarp can determi...
Java 8
standard input
[ "data structures", "two pointers", "binary search", "greedy" ]
cc1b29b49711131d4790d91d0fae4a5a
The first line contains three integers $$$n$$$, $$$m$$$, $$$d$$$ $$$(1 \le n \le 2\cdot10^{5}, n \le m \le 10^{9}, 1 \le d \le m)$$$Β β€” the number of coffee breaks Monocarp wants to have, the length of each working day, and the minimum number of minutes between any two consecutive coffee breaks. The second line contains...
1,600
In the first line, write the minimum number of days required to make a coffee break in each of the $$$n$$$ given minutes. In the second line, print $$$n$$$ space separated integers. The $$$i$$$-th of integers should be the index of the day during which Monocarp should have a coffee break at minute $$$a_i$$$. Days are ...
standard output
PASSED
a6056210d69cff99b40591f34cb27baa
train_000.jsonl
1601827500
Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th...
256 megabytes
import java.util.*; import java.io.*; public class Problem { static int memo[][]; static long a, b, c, n, v, m, e, t; static ArrayList[] edgeList; static int[][] matrix; // static int[] a; final static int Infinity = Integer.MAX_VALUE; public static void main(String[] args) throws Exception { Scanner sc = new...
Java
["2\n1 2 3\n12 34 56"]
1 second
["4\n42"]
NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$.
Java 8
standard input
[ "geometry", "math" ]
40d679f53417ba058144c745e7a2c76d
The first line contains a single integer $$$t$$$Β β€” the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$Β β€” the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$).
800
For each test case print a single integer $$$d$$$Β β€” the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists.
standard output