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
4389a3e98842104d2eb189d42f0663df
train_001.jsonl
1586700300
You have array of $$$n$$$ numbers $$$a_{1}, a_{2}, \ldots, a_{n}$$$. Rearrange these numbers to satisfy $$$|a_{1} - a_{2}| \le |a_{2} - a_{3}| \le \ldots \le |a_{n-1} - a_{n}|$$$, where $$$|x|$$$ denotes absolute value of $$$x$$$. It's always possible to find such rearrangement.Note that all numbers in $$$a$$$ are not ...
256 megabytes
import java.util.*; import java.io.*; public class watermelon { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //BufferedReader br = new BufferedReader(new FileReader("input.txt")); int tests = Integer.parseInt(br.readLi...
Java
["2\n6\n5 -2 4 8 6 5\n4\n8 1 4 2"]
1 second
["5 5 4 6 8 -2\n1 2 4 8"]
NoteIn the first test case, after given rearrangement, $$$|a_{1} - a_{2}| = 0 \le |a_{2} - a_{3}| = 1 \le |a_{3} - a_{4}| = 2 \le |a_{4} - a_{5}| = 2 \le |a_{5} - a_{6}| = 10$$$. There are other possible answers like "5 4 5 6 -2 8".In the second test case, after given rearrangement, $$$|a_{1} - a_{2}| = 1 \le |a_{2} - ...
Java 11
standard input
[ "constructive algorithms", "sortings" ]
3c8bfd3199a9435cfbdee1daaacbd1b3
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$) — the number of test cases. The first line of each test case contains single integer $$$n$$$ ($$$3 \le n \le 10^{5}$$$) — the length of array $$$a$$$. It is guaranteed that the sum of values of $$$n$$$ over all test cases in the input does not ...
1,200
For each test case, print the rearranged version of array $$$a$$$ which satisfies given condition. If there are multiple valid rearrangements, print any of them.
standard output
PASSED
7f80d5595dd8dbb123c57f40986dd587
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
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.Map; import java.util.StringTokenizer; import java.util.TreeMap; /* * To change this license header, choose License Headers in Project Properties. * T...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
fb819efdcff70ddb33c51483d2b4802f
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.StringTokenizer; public class Polygons ...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
5a6a6f14bf572414ed5acb11d679c014
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CF_166_B_POLYGONS { static final double EPS = 10e-10; static double angle(Point a, Point o, Point b) { Vector oa = new Vector(o, a), ob = new Ve...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
ea0a24a73d447b6370be2eb2e0bc9a17
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.*; import java.net.Inet4Address; import java.util.*; public class B { private static final Comparator<int[]> cmp = new Comparator<int[]>() { @Override public int compare(int[] a, int[] b) { for(int i = 0 ; i < a.length ; i++) if(a[i] != b[i]) ...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
25c8d672b046777713560e4dfdfd9ce5
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Polygons { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int n =sc.nex...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
0b3208504e5ed75b639141c301554f8e
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import sun.print.resources.serviceui; import java.io.*; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); Point[] A = new Point[n]; for(...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
12eab6d126764b9c347fd8d3caf7de87
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import sun.print.resources.serviceui; import java.io.*; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); Point[] A = new Point[n]; for(...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
3af8c5d2c101c4e9438e034b44ef8384
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; @SuppressWarnings("unchecked") public class P166B { int n; long [][] a, va; boolean checkIntern(long x, long y) { for (int i = 0; i < n; i++) { if ((va[i][0] * (y - a[i][1]) - va[i][1] * (x -...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
412ad48c0005ef3c967bb341e91881ee
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Polygons { static final double EPS = 1e-15; public static void main(String[] args) throws IOException { Scanner sc = new S...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
8626f6ce0a58b8d54e01b694382e3566
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
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.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.StringTokenizer; public class Polygons { ...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
8acb91e6afb7c70090731dd83fcf7e5a
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.*; import java.util.*; public class B { Reader in; PrintWriter out; String TEST_INPUT=""; void solve(){ int n=in.nextInt(); Vect[] A = new Vect[n]; for(int i=0; i<n; i++) A[i]=new Vect(in.nextLong(),in.nextLong()); int m=in.nextInt(); for(int ...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
6bcddcff5b6f0c805a634eb91e1aad9a
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
// package CF; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class F { static final double EPS = 1e-9; static Point [] p; public static void ...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
49fa1e69b7f18911eae00d3247aff61b
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashSet; import java.util.StringTokenizer; public class polygons { public static void main (String[] args) throws IOException, InterruptedException{ Buff...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
34d2f161e4666abd4c94196bde06cc77
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.Arrays; import java.util.HashSet; import java.util.PriorityQueue; import java.util.StringTokenizer; import java.util.TreeS...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
58e623c8872a89f4892bdc0b3f7b972e
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; import java.util.List; import java.util.Vector; import java.util.StringTokenizer; import java.io...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
38ea1bf9b3007454fccaf585d7fd1028
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class Point { long X; long Y; Point(long X, long Y){ this.X =X; this.Y =Y; } } static long orient(Point p, Point q, Point r) { long val = (((q.Y - p.Y) * (r.X - q.X)) - ((q.X - ...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
ad9113100eac53cec5dc374a4090797c
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
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.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; public class B { static final double INF = 1e9, EPS = 1e-9; static class Point im...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
1f94bd643cfe38149bbb4e71acb14606
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); Point point[] = new Point[n]; for (int i = 0; i < n; i++) point[i] = new Point(s.nextInt(), s.nextInt()); Point...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
f38147e340d34418962e416ca0247aa6
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { static class Point { int x, y; Point (int xx, ...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
d2f6a26c933466b8c39f725a13afed84
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; @SuppressWarnings("unchecked") public class B { public static void main(String[] args) { new B(); } int aLen,bLen; Vector a[],b[]; final double EPSILON = 1E-12; B() { Scanner in = new Scanner(...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
07cac11fc83969074b17e388b4869ef9
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; @SuppressWarnings("unchecked") public class B { public static void main(String[] args) { new B(); } int aLen,bLen; Vector a[],b[]; final double EPSILON = 1E-12; //this value was too big, and got a wro...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
85bf5efa26bd592e788055baa3bd5eb9
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
//package maths; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class PointInPolygon { static boolean pointInPolygon(Point p,Point []pts) { int l,r,mid; int n=pts.length;...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
3fc867afb53b9c7af93008205fabfdef
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
//package maths; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class PointInPolygon { static boolean inside(Point [] p, Point q){ int lo = 1, hi = p.length-1; if(ccw(p[0...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
37e494d7181cdf2bda0250a8d8858a61
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
//package maths; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class PointInPolygon { /*static boolean pointInPolygon(Point p,Point []pts) { int n=pts.length-1; int l=...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
da04c5f07d5ea34e970e44472115b0ca
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.*; import java.util.*; public class A { static Point[] convexHull(Point[] points) { int n = points.length; Arrays.sort(points); Point[] ans = new Point[n<<1]; int size = 0, start = 0; for(int i = 0; i < n; i++) { Point p = points[i]; while(size - start >= 2 && !Point.ccw(an...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
175ae1613d47b8b891cd5056055b7aa9
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.util.Scanner; public class CF166B_Polygons { final static double EPS=1e-9; static Point g[]; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n =sc.nextInt(); g = new Point[n]; for(int i=0;i<n;i++){ g[i]=new Point(sc.nextInt(), sc.nextInt()); } int m =...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
0d2978fea48f7bf68ac06197bf9dee17
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class TC_a { static final double EPS = 1e-9; static class Point { long x,y; public P...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
a864657b6f329d390ccb354d60eb2d34
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map.Entry; import java.util.PriorityQueue...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
21e6df66c52737c7431056a22273932d
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.*; import java.util.*; public class B166 { public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(); Point[] a = new Point[n]; for(int i = 0; i<n; i++) a[i] = new Point(input.nextInt(), in...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
aba3524ef811cb99b4d625b8f4a2a0c7
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.*; import java.util.*; public class B166 { public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(); Point[] a = new Point[n]; for(int i = 0; i<n; i++) a[i] = new Point(input.nextInt(), in...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
7242212b474d78d87dfc3da381d327c0
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.*; import java.util.*; public class B166 { public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(); Point[] a = new Point[n]; for(int i = 0; i<n; i++) a[i] = new Point(input.nextInt(), in...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
5d16ee063579480c1a8b95ea1e294f6c
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class Polygons { public static void main(String[] args) throws NumberFormatException, IOException { ...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
4c01b31323c61ff1c4479261a454bcaf
train_001.jsonl
1332516600
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecu...
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.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; public class B { public static void main(String[] args) throws IOException{ Scan...
Java
["6\n-2 1\n0 3\n3 3\n4 1\n3 -2\n2 -2\n4\n0 1\n2 2\n3 1\n1 0", "5\n1 2\n4 2\n3 -3\n-2 -2\n-2 1\n4\n0 1\n1 2\n4 1\n2 -1", "5\n-1 2\n2 3\n4 1\n3 -2\n0 -3\n5\n1 0\n1 1\n3 1\n5 -1\n2 -1"]
2 seconds
["YES", "NO", "NO"]
null
Java 8
standard input
[ "sortings", "geometry" ]
d9eb0f6f82bd09ea53a1dbbd7242c497
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers xi, yi (|xi|, |yi| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order. The next line contains a single integer m (3 ≤ m ≤ 2Ā·104) — the n...
2,100
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
standard output
PASSED
a8da8e48583b5ac1f00ea45f6e0e01ec
train_001.jsonl
1342450800
Vasya the carpenter has an estate that is separated from the wood by a fence. The fence consists of n planks put in a line. The fence is not closed in a circle. The planks are numbered from left to right from 1 to n, the i-th plank is of height ai. All planks have the same width, the lower edge of each plank is located...
256 megabytes
import java.io.*; import java.lang.Math; import java.util.*; public class Main { public BufferedReader in; public Formatter out; //public PrintStream out; public boolean log_enabled = false; int n; long[] A; int[] L,R,T; public int findtLeft(int i) { if (i==0) { return 1; } if (A[i-1]<=A[...
Java
["3\n3 2 1\n3\n1 2 3", "2\n1 1\n3\n1 2 1"]
5 seconds
["2.000000000000000\n1.500000000000000\n1.000000000000000", "1.000000000000000\n1.000000000000000\n1.000000000000000"]
NoteLet's consider the first sample test. There are three possible positions of the fence for k1 = 1. For the first position (x = 1) the height is 3, for the second one (x = 2) the height is 2, for the third one (x = 3) the height is 1. As the fence position is chosen uniformly, the expected height of the fence equal...
Java 6
standard input
[ "data structures", "dsu", "binary search" ]
a8859b3f0f5db57c359399bd9315e240
The first line contains a single integer n (1 ≤ n ≤ 106) — the number of planks in the fence. The second line contains a sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 109) where ai is the height of the i-th plank of the fence. The third line contains an integer m (1 ≤ m ≤ 106) and the next line contains m space-separa...
2,500
Print m whitespace-separated real numbers, the i-th number equals the expected value of the rectangle height, if its width in planks equals ki. The value will be considered correct if its absolute or relative error doesn't exceed 10 - 9.
standard output
PASSED
d77cac65e68910d1ba2639fda4b455b5
train_001.jsonl
1342450800
Vasya the carpenter has an estate that is separated from the wood by a fence. The fence consists of n planks put in a line. The fence is not closed in a circle. The planks are numbered from left to right from 1 to n, the i-th plank is of height ai. All planks have the same width, the lower edge of each plank is located...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHe...
Java
["3\n3 2 1\n3\n1 2 3", "2\n1 1\n3\n1 2 1"]
5 seconds
["2.000000000000000\n1.500000000000000\n1.000000000000000", "1.000000000000000\n1.000000000000000\n1.000000000000000"]
NoteLet's consider the first sample test. There are three possible positions of the fence for k1 = 1. For the first position (x = 1) the height is 3, for the second one (x = 2) the height is 2, for the third one (x = 3) the height is 1. As the fence position is chosen uniformly, the expected height of the fence equal...
Java 6
standard input
[ "data structures", "dsu", "binary search" ]
a8859b3f0f5db57c359399bd9315e240
The first line contains a single integer n (1 ≤ n ≤ 106) — the number of planks in the fence. The second line contains a sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 109) where ai is the height of the i-th plank of the fence. The third line contains an integer m (1 ≤ m ≤ 106) and the next line contains m space-separa...
2,500
Print m whitespace-separated real numbers, the i-th number equals the expected value of the rectangle height, if its width in planks equals ki. The value will be considered correct if its absolute or relative error doesn't exceed 10 - 9.
standard output
PASSED
3a14d05530dc5f0fd251b1dcd3605569
train_001.jsonl
1342450800
Vasya the carpenter has an estate that is separated from the wood by a fence. The fence consists of n planks put in a line. The fence is not closed in a circle. The planks are numbered from left to right from 1 to n, the i-th plank is of height ai. All planks have the same width, the lower edge of each plank is located...
256 megabytes
import java.io.*; import java.util.*; public class Solution { private StringTokenizer st; private BufferedReader in; private PrintWriter out; public void solve() throws IOException { int n = nextInt(); // Random rnd = new Random(); long[] a = new long[n + 1]; for (int i = 0; i < n; ++i) { a[i] = next...
Java
["3\n3 2 1\n3\n1 2 3", "2\n1 1\n3\n1 2 1"]
5 seconds
["2.000000000000000\n1.500000000000000\n1.000000000000000", "1.000000000000000\n1.000000000000000\n1.000000000000000"]
NoteLet's consider the first sample test. There are three possible positions of the fence for k1 = 1. For the first position (x = 1) the height is 3, for the second one (x = 2) the height is 2, for the third one (x = 3) the height is 1. As the fence position is chosen uniformly, the expected height of the fence equal...
Java 6
standard input
[ "data structures", "dsu", "binary search" ]
a8859b3f0f5db57c359399bd9315e240
The first line contains a single integer n (1 ≤ n ≤ 106) — the number of planks in the fence. The second line contains a sequence of integers a1, a2, ..., an (1 ≤ ai ≤ 109) where ai is the height of the i-th plank of the fence. The third line contains an integer m (1 ≤ m ≤ 106) and the next line contains m space-separa...
2,500
Print m whitespace-separated real numbers, the i-th number equals the expected value of the rectangle height, if its width in planks equals ki. The value will be considered correct if its absolute or relative error doesn't exceed 10 - 9.
standard output
PASSED
7813bd356ab565a83858089cc8a4a2d0
train_001.jsonl
1372433400
Fox Ciel has a board with n rows and n columns, there is one integer in each cell.It's known that n is an odd number, so let's introduce . Fox Ciel can do the following operation many times: she choose a sub-board with size x rows and x columns, then all numbers in it will be multiplied by -1.Return the maximal sum of ...
256 megabytes
import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.FileOutputStream; import java.io.PrintWriter; import java.io.FileInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Mike Lee */ public class Main { pu...
Java
["3\n-1 -1 1\n-1 1 -1\n1 -1 -1", "5\n-2 0 0 0 -2\n0 -2 0 -2 0\n0 0 -2 0 0\n0 -2 0 -2 0\n-2 0 0 0 -2"]
4 seconds
["9", "18"]
NoteIn the first test, we can apply this operation twice: first on the top left 2 × 2 sub-board, then on the bottom right 2 × 2 sub-board. Then all numbers will become positive.
Java 7
standard input
[ "dp", "greedy", "math" ]
7f9d69890e6b7acbfd419388f5d3cef5
The first line contains an integer n, (1 ≤ n ≤ 33, and n is an odd integer) — the size of the board. Each of the next n lines contains n integers — the numbers in the board. Each number doesn't exceed 1000 by its absolute value.
2,900
Output a single integer: the maximal sum of numbers in the board that can be accomplished.
standard output
PASSED
65581d1c6a93c8bff78cdbf8b635d10d
train_001.jsonl
1372433400
Fox Ciel has a board with n rows and n columns, there is one integer in each cell.It's known that n is an odd number, so let's introduce . Fox Ciel can do the following operation many times: she choose a sub-board with size x rows and x columns, then all numbers in it will be multiplied by -1.Return the maximal sum of ...
256 megabytes
import java.util.*; import java.io.*; public class CielAndFlipboard { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner cin = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); ...
Java
["3\n-1 -1 1\n-1 1 -1\n1 -1 -1", "5\n-2 0 0 0 -2\n0 -2 0 -2 0\n0 0 -2 0 0\n0 -2 0 -2 0\n-2 0 0 0 -2"]
4 seconds
["9", "18"]
NoteIn the first test, we can apply this operation twice: first on the top left 2 × 2 sub-board, then on the bottom right 2 × 2 sub-board. Then all numbers will become positive.
Java 7
standard input
[ "dp", "greedy", "math" ]
7f9d69890e6b7acbfd419388f5d3cef5
The first line contains an integer n, (1 ≤ n ≤ 33, and n is an odd integer) — the size of the board. Each of the next n lines contains n integers — the numbers in the board. Each number doesn't exceed 1000 by its absolute value.
2,900
Output a single integer: the maximal sum of numbers in the board that can be accomplished.
standard output
PASSED
cd0854b46392187d2aa1d63a462c98aa
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class MainClass { public static void main(String[] args) throws IOException { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); int n=in.nextInt(); HashMap<Integer,Integer> hm=new HashMap<Int...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
2b5d85b280b0e46d7fc3cfd9b6aa2de4
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.util.*; import java.text.*; public class Main{ public static void main(String[] afzalkhan){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int A[] = new int[100000]; int B[] = new int[100005]; for(int i=0;i<N;i++){ A[i] = sc.nextInt(); ...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
ac0b7ed2273bf4a0bc9b4778221475f2
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; ...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
c7a19ce89c609e9377f0df10a1f4cb76
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Main { BufferedReader br; StringTokenizer in; PrintWriter pw; Random r; int INF = (int) 1e9; long LNF = (long) 1e18; long mod = (long) (1e9 + 7); // you shall not hack!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
cb4c0d0917f1122fad345b229e80b875
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.BigDecimal; public class R458B { public static void main (String[] args) throws java.lang.Exception { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); ...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
1d0ff1a8a890fd47eb43be80aa40f85c
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; import java.util.Collections; public class Solution { static class Solver { Solver() { } public void solve(FastScanner sc, PrintWriter out) throws IOException { int n = sc.nextInt(); int[] freq = new int[(i...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
cb46fddf9bebb20ca174fb66ce5af12b
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.HashMap; public class CFR458B { static int n, a, count[] = new int[100001]; static HashMap<String, ArrayList<Integer>> hm = new HashMap<>(); static String ins[]; static boolean isWinConan = false; public static void main(String[] args) ...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
1f00a30fc508beb00476e4f20df40c87
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class cc_B { InputStream is; PrintWriter out; int n; long a[]; private boolean oj = System.getProperty("ONLINE_JUDGE") != nu...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
53f5ff02432304a66bf5095f6b5c56eb
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
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.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class B_ { static...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
184a6e1b1063c5066a4a255e09c4c216
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class CardGameB458 { public static void main(String[] args) thro...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
0d248390a323b264e1f3e9f5a38ae693
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { Scanner in = new Scanner(System.in); int a; a=in.nextInt(); if(a==1){ System.out.println("Conan"); return;} int l; int[] b=new int[100009]; for(int i=0;i<a;i++){ b[in.nextInt()]++; } for(int x:b)...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
114997c1a5e16c46b6aa3bc7b223c2e4
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class scorify{ public static void main(String[] args){ Scanner in=new Scanner(System.in); int n = in.nextInt(),count=0,temp,one=0; Map<Integer,Integer> map = new HashMap<Integer,Integer>(); for(int i=0 ; i<n ; i++){ temp = in....
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
640716c562f0a53d43fa91207aff43dd
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
//Code by Sounak, IIEST import java.io.*; import java.math.*; import java.util.*; import java.util.Arrays; public class Test1{ public static void main(String args[])throws IOException{ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int a[]=new int[n]; int i,max=0,count=1; ...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
fbd62418261da3eee7ff55c0f5f1fce2
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
//package codeforce_458; import java.util.*; public class B { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); ArrayList<Integer> list = new ArrayList<Integer>(); for(int i = 0; i < n; i++) { list.add(in.nextInt()); } Collections.sort(list); ...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
ca419c8a39c9cbedda5638d7a8645313
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); int[] cards = new int[n]; for (int i = 0; i < n; i++) { cards[i] = sc.nextInt(); ...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
bce3548ce84a3921117688959e4eba60
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class B914 { public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(Sy...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
0a95e1824ba2c0c2f26390efec53bb2d
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
f2a17448c72d1575893ec2583b2e5ee3
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
c17eb46a3344fc9016891bb487e7d3e5
train_001.jsonl
1516462500
Edogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has n cards, and the i-th card has a number ai written on it.They take turns playing, starting with Conan. In each turn, the player chooses a card and removes it. Also, he removes all car...
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 = Syste...
Java
["3\n4 5 7", "2\n1 1"]
2 seconds
["Conan", "Agasa"]
NoteIn the first example, Conan can just choose the card having number 7 on it and hence remove all the cards. After that, there are no cards left on Agasa's turn.In the second example, no matter which card Conan chooses, there will be one one card left, which Agasa can choose. After that, there are no cards left when ...
Java 8
standard input
[ "implementation", "greedy", "games" ]
864593dc3911206b627dab711025e116
The first line contains an integer n (1 ≤ n ≤ 105) — the number of cards Conan has. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105), where ai is the number on the i-th card.
1,200
If Conan wins, print "Conan" (without quotes), otherwise print "Agasa" (without quotes).
standard output
PASSED
da6ca2775954b10342384e3ef89976bf
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class D2 { public static void main(String[] args) { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); ...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
c903bfccd01b306c255fec9d576b5546
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.*; public class RemoveSubstrings { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); String t = br.readLine(); int left = -1; int right = s.length(); int count = 0; int maxDist = 0...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
8d3091fe602037be280568caeb2f7844
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.*; import java.util.Arrays; public class _1203D2 { BufferedReader bf; InputStream is; public _1203D2(InputStream is){ this.is = is; this.bf = new BufferedReader(new InputStreamReader(is)); } public int[] ints(int size){ try{ String[] data = bf.read...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
4d773074b4a5165dd9bc74d653724161
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.util.*; import java.io.*; public class removeSubstring { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static String[] line; static PrintWriter pw = new PrintWriter(System.out); static int n, m; static char[] s, t; static int[] pre, post; public static void main(S...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
72df4ee1f74cfdfd2aebb675acf79de4
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
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
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
2515895dfd1d410652e6ab55dc2f0677
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import static java.lang.System.out; import static java.lang.Math.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); String rs = (new StringBuilder(s)).reverse().toString(); ...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
30da5154d3db90ec2aba424516ca0702
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br; static PrintWriter pr; static int cin() throws Exception { return Integer.valueOf(br.readLine()); } static int[] split() throws Exception { String[] cmd=br.readLine().split(" "); int[] ans=new int[cmd.length]; for(int i=...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
50deede397dedec831463b36e52c8d8e
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { static long mod=(long)(1e+9 + 7); ...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
cb74222f82b9f67ab18a4d91a0fb29fd
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.util.Scanner; public class ProblemD { public static void main(String[] args) { // TODO Auto-generated method stub Scanner S = new Scanner(System.in); String s = S.next(); String t = S.next(); int[] left = new int[t.length()]; int[] right = new int[t.length()]; int l = 0; for(...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
6b22cbc12bde0b853fcafb6e276ce70b
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String a = br.readLine(); String b = br.readLine(); char[] s = a.toCharArray(); char[]t = b.toCharArray(); ...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
5c0f18e979c1aaf8fb41cd450d92de6c
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.InputStreamReader; public class D21203 { public static void main(String[] args) throws Exception { // BufferedReader br = new BufferedReader(new FileReader("F:/books/input.txt")); BufferedReader br = new...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
2ee9280ff14c95ac52471a9e862f6851
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.*; public class Newbie { static InputReader sc = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { solver s = new solver(); ...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
ae3c495619db00c91e8903ac06b32e72
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; /** * Built using CHelper plug-in * Actual solution is at the top */ public class RemoveTheSubstring { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputRead...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
61e7b6c1ddf6371e2d83aec8b9ee577a
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.util.Scanner; public class TaskD { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s1=in.next(); String s2=in.next(); //System.out.println(s1.length() + " " + s2.length()); int[] front=new int[s2.length()]; int[] bac...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
f0ac96815b039532810e3194042e0524
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.Input...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
f537c9f41165506a066a8446b299b5c7
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //BufferedReader br = new BufferedReader(new FileReader("input.txt")); StringTokenizer st; ...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
5eda4af293acbdbd7b671200540a059c
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.PrintWriter; import java.util.Arrays; import java.util.Deque; import java.util.LinkedList; import java.util.PriorityQueue; import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter wr = new PrintWriter(System.out); char s...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
1bfd8a0830d106671468e3f8b9648f7e
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.util.*; import java.io.*; import java.io.FileWriter; // Solution public class Main { public static void main (String[] argv) { new Main(); } boolean test = false; final int MOD = 998244353; //1000000007; public Main() { FastReader in = new FastRea...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
0a9fcfed85cefed312de06ed7eb25980
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.util.*; import java.io.*; public class RemoveTheSubstring { public static void main(String[] args) { FastScanner scanner = new FastScanner(); PrintWriter out = new PrintWriter(System.out); String s = scanner.next(); String t = scanner.next(); int n = s.length(); ...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
21ee3fe22f12c92b374be511426b03b5
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.util.*; import java.io.*; public class codeforces{ // Input static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader() { reader = new BufferedReader(new InputStreamReader(System.in)); tokenizer = nul...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
4d0a5562b045a61e328062eed8a430f3
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class p1203D { public void realMain() throws Exception { BufferedReader fin = new BufferedReader(new InputStreamReader(System.in), 1000000); String in = fin.readLine(); String ss = " " + in + " "; in = fin.readLine(); String ts = in; ch...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
532d73ab96a1ceeb268ed982cd1acb9f
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class AA { public static void main(String[] args) throws Exception { Scann...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
d12ccaa03b85eec7e296c03f9bde50f8
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.*; public class Q4 { static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); static class FastScanner { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars;...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
ece741e52dd4bb228bab7f6aef02f6b2
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System....
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
722b827fb2cb784688381016a4b14b16
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import javax.print.attribute.standard.PrinterMessageFromOperator; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) throws Exception { new Main().run();} // int[] h,ne,to,wt; // int ct = 0; // ...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
b01615c5a1411ad1458f60c0edcacae1
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(); PrintWriter out = new PrintWriter(System.out); char[] s = sc.next().toCharArray(), t = sc.next().toCharArray(); int ans = ...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
5f660e3fb4cfd1972718eea1fad3776e
train_001.jsonl
1565706900
The only difference between easy and hard versions is the length of the string.You are given a string $$$s$$$ and a string $$$t$$$, both consisting only of lowercase Latin letters. It is guaranteed that $$$t$$$ can be obtained from $$$s$$$ by removing some (possibly, zero) number of characters (not necessary contiguous...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; public class Solve6 { public static void main(String[] args) throws IOException { PrintWriter pw = new PrintWriter(System.out...
Java
["bbaba\nbb", "baaba\nab", "abcde\nabcde", "asdfasdf\nfasd"]
2 seconds
["3", "2", "0", "3"]
null
Java 8
standard input
[ "two pointers", "binary search", "implementation", "greedy" ]
0fd33e1bdfd6c91feb3bf00a2461603f
The first line of the input contains one string $$$s$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. The second line of the input contains one string $$$t$$$ consisting of at least $$$1$$$ and at most $$$200$$$ lowercase Latin letters. It is guaranteed that $$$t$$$ is a subsequence of $...
1,700
Print one integer — the maximum possible length of the substring you can remove so that $$$t$$$ is still a subsequence of $$$s$$$.
standard output
PASSED
a9ac5e273e5b9c1cc46ef89c7f3bdb34
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; //http://codeforces.com/contest/1077/problem/F1 //F1. Pictures with Kittens (easy version) //Codeforces Round #521 (Div. 3) public class RecursionSimple { static int n, k, x; static Long[][][] dp; public static void main(S...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
bb2c9aa010b13b73bd6258e2868f2c0c
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
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.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { ...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
7b045db5e1e3e59763e723660f90f3be
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
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.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { ...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
234041dafec0a6274ddda5a8af7e1bf7
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
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.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { ...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
534f7597e509813ef352b44007a7115d
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
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.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { ...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
03c8a6cbd08019af72c4b2adbcef56f7
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.*; public class PicturesWithKitten { public static void main(String[] args) { FastScanner scanner = new FastScanner(); int N = scanner.nextInt(); int K = scann...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
ca24a63f1272cbd6522630ad5fce05bf
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Random; import jav...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
61d158d160974348a654b7fcff41aa9b
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
873973f849ea4e308847e5cfec2d9c9e
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; public class Main { public void sort(long b[]){ Random rd = new Random(); for(int i=1;i<b.length;++i){ int c = rd.nextInt(i); long v = b[c]; b[c] = b[i]; ...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
ba893f72d02a7c732bf63d5aced16f28
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; public class Main { public void sort(long b[]){ Random rd = new Random(); for(int i=1;i<b.length;++i){ int c = rd.nextInt(i); long v = b[c]; b[c] = b[i]; ...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
11e8197cd12dca45a24d998414978dd7
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class CFR { static final int UNCALC = -1; static final long INF = (long) 1e15; static long[][][] memo; static int k, n, a[]; public static void main(String[] args) throws IOException { Scanner sc = new Sca...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
b250e8078db7bbeb71332876dd152e4c
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
256 megabytes
import java.io.*; import java.util.*; public final class TaskF1 { public static void main(String[] args) { new TaskF1(System.in, System.out); } static class Solver implements Runnable { static final long INF = (long) 1e15; int n, k, x; int[] arr; long[][][] dp; boolean possibl...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
a3de49e3e7856ef7ed47369f8645ca6c
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Solution { public static void main(String[] args) { Solution solution = new Solution(); solution.solve(); } private void solve() { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.n...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
d81b9300f8a2c0622395b94f199e7744
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Solution solution = new Solution(); solution.solve(); } private void solve() { Scanner in = new Scanner(System.in); int n = in.nextInt(); int d = in.nextInt(); int m =...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output
PASSED
dcd88e999a04b05c7e757e513b0cfc62
train_001.jsonl
1542378900
The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Solution { public static void main(String[] args) { Solution solution = new Solution(); solution.solve(); } private void solve() { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.n...
Java
["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"]
2 seconds
["18", "-1", "100"]
null
Java 8
standard input
[ "dp" ]
c1d48f546f79b0fd58539a1eb32917dd
The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $...
1,900
Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement.
standard output