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
56b2bca7b6b4ab315de2181e081cf66e
train_000.jsonl
1291046400
The territory of Berland is represented by a rectangular field n × m in size. The king of Berland lives in the capital, located on the upper left square (1, 1). The lower right square has coordinates (n, m). One day the king decided to travel through the whole country and return back to the capital, having visited ever...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; /** * * * 3 2 3 5 * -2 -1 4 -1 2 7 3 * * * @author pttrung */ public class D { public static long MOD = 1000000007;...
Java
["2 2", "3 3"]
2 seconds
["0\n1 1\n1 2\n2 2\n2 1\n1 1", "1\n3 3 1 1\n1 1\n1 2\n1 3\n2 3\n2 2\n2 1\n3 1\n3 2\n3 3\n1 1"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
a98622d5b6d6d139df90b6fee3baa544
The first line contains two space-separated integers n and m (1 ≀ n, m ≀ 100, 2 ≀  n Β· m) β€” the field size. The upper left square has coordinates (1, 1), and the lower right square has coordinates of (n, m).
2,000
On the first line output integer k β€” the minimum number of teleporters. Then output k lines each containing 4 integers x1 y1 x2 y2 (1 ≀ x1, x2 ≀ n, 1 ≀ y1, y2 ≀ m) β€” the coordinates of the square where the teleporter is installed (x1, y1), and the coordinates of the square where the teleporter leads (x2, y2). Then prin...
standard output
PASSED
ccad61507afb6d965f948571eb3a8f9a
train_000.jsonl
1291046400
The territory of Berland is represented by a rectangular field n × m in size. The king of Berland lives in the capital, located on the upper left square (1, 1). The lower right square has coordinates (n, m). One day the king decided to travel through the whole country and return back to the capital, having visited ever...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class D { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); ...
Java
["2 2", "3 3"]
2 seconds
["0\n1 1\n1 2\n2 2\n2 1\n1 1", "1\n3 3 1 1\n1 1\n1 2\n1 3\n2 3\n2 2\n2 1\n3 1\n3 2\n3 3\n1 1"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
a98622d5b6d6d139df90b6fee3baa544
The first line contains two space-separated integers n and m (1 ≀ n, m ≀ 100, 2 ≀  n Β· m) β€” the field size. The upper left square has coordinates (1, 1), and the lower right square has coordinates of (n, m).
2,000
On the first line output integer k β€” the minimum number of teleporters. Then output k lines each containing 4 integers x1 y1 x2 y2 (1 ≀ x1, x2 ≀ n, 1 ≀ y1, y2 ≀ m) β€” the coordinates of the square where the teleporter is installed (x1, y1), and the coordinates of the square where the teleporter leads (x2, y2). Then prin...
standard output
PASSED
7196dea8fa8369a74e6c2fc42b90b567
train_000.jsonl
1291046400
The territory of Berland is represented by a rectangular field n × m in size. The king of Berland lives in the capital, located on the upper left square (1, 1). The lower right square has coordinates (n, m). One day the king decided to travel through the whole country and return back to the capital, having visited ever...
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.StringTokenizer; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { ...
Java
["2 2", "3 3"]
2 seconds
["0\n1 1\n1 2\n2 2\n2 1\n1 1", "1\n3 3 1 1\n1 1\n1 2\n1 3\n2 3\n2 2\n2 1\n3 1\n3 2\n3 3\n1 1"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
a98622d5b6d6d139df90b6fee3baa544
The first line contains two space-separated integers n and m (1 ≀ n, m ≀ 100, 2 ≀  n Β· m) β€” the field size. The upper left square has coordinates (1, 1), and the lower right square has coordinates of (n, m).
2,000
On the first line output integer k β€” the minimum number of teleporters. Then output k lines each containing 4 integers x1 y1 x2 y2 (1 ≀ x1, x2 ≀ n, 1 ≀ y1, y2 ≀ m) β€” the coordinates of the square where the teleporter is installed (x1, y1), and the coordinates of the square where the teleporter leads (x2, y2). Then prin...
standard output
PASSED
912009c069e85e2a00d05e24f9aa63a3
train_000.jsonl
1291046400
The territory of Berland is represented by a rectangular field n × m in size. The king of Berland lives in the capital, located on the upper left square (1, 1). The lower right square has coordinates (n, m). One day the king decided to travel through the whole country and return back to the capital, having visited ever...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchEx...
Java
["2 2", "3 3"]
2 seconds
["0\n1 1\n1 2\n2 2\n2 1\n1 1", "1\n3 3 1 1\n1 1\n1 2\n1 3\n2 3\n2 2\n2 1\n3 1\n3 2\n3 3\n1 1"]
null
Java 7
standard input
[ "constructive algorithms", "implementation", "brute force" ]
a98622d5b6d6d139df90b6fee3baa544
The first line contains two space-separated integers n and m (1 ≀ n, m ≀ 100, 2 ≀  n Β· m) β€” the field size. The upper left square has coordinates (1, 1), and the lower right square has coordinates of (n, m).
2,000
On the first line output integer k β€” the minimum number of teleporters. Then output k lines each containing 4 integers x1 y1 x2 y2 (1 ≀ x1, x2 ≀ n, 1 ≀ y1, y2 ≀ m) β€” the coordinates of the square where the teleporter is installed (x1, y1), and the coordinates of the square where the teleporter leads (x2, y2). Then prin...
standard output
PASSED
826952c3c456e2b2c267b88077801352
train_000.jsonl
1407690000
You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he will vote for, and how much it will cost to bribe that person to vote for you instead of whomever he wants to vote for right now. You are curious, what is the smallest am...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; public class Main implements Runnable { static final int MOD = (int) 1e9 + 7; static final int MI = (int) 1e9; static final long ML =...
Java
["5\n1 2\n1 2\n1 2\n2 1\n0 0", "4\n1 2\n1 2\n2 1\n0 0", "1\n100000 0"]
2 seconds
["3", "2", "0"]
null
Java 8
standard input
[ "data structures", "ternary search" ]
2a0362376ddeaf3548d5419d1e70b4d3
First line contains one integer n (1 ≀ n ≀ 105) β€” number of voters in the city. Each of the next n lines describes one voter and contains two integers ai and bi (0 ≀ ai ≀ 105;Β 0 ≀ bi ≀ 104) β€” number of the candidate that voter is going to vote for and amount of money you need to pay him to change his mind. You are the ...
2,100
Print one integer β€” smallest amount of money you need to spend to win the elections.
standard output
PASSED
4457ac915c97051a6fa69892c74c4e20
train_000.jsonl
1407690000
You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he will vote for, and how much it will cost to bribe that person to vote for you instead of whomever he wants to vote for right now. You are curious, what is the smallest am...
256 megabytes
import java.util.List; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.ArrayList; import java.io.PrintStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Random; import java.io.Writer; i...
Java
["5\n1 2\n1 2\n1 2\n2 1\n0 0", "4\n1 2\n1 2\n2 1\n0 0", "1\n100000 0"]
2 seconds
["3", "2", "0"]
null
Java 8
standard input
[ "data structures", "ternary search" ]
2a0362376ddeaf3548d5419d1e70b4d3
First line contains one integer n (1 ≀ n ≀ 105) β€” number of voters in the city. Each of the next n lines describes one voter and contains two integers ai and bi (0 ≀ ai ≀ 105;Β 0 ≀ bi ≀ 104) β€” number of the candidate that voter is going to vote for and amount of money you need to pay him to change his mind. You are the ...
2,100
Print one integer β€” smallest amount of money you need to spend to win the elections.
standard output
PASSED
3863a72e9f8b925dfb535c22e3a614d8
train_000.jsonl
1407690000
You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he will vote for, and how much it will cost to bribe that person to vote for you instead of whomever he wants to vote for right now. You are curious, what is the smallest am...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger.*; import static java.lang.Math.*; import static java.math.BigInteger.*; import static java.util.Arrays.*; import java.util.logging.Level; import java.util.logging.Logger; // https://netbeans.org/kb/73/java/editor-codereference_ru.html#display //<edito...
Java
["5\n1 2\n1 2\n1 2\n2 1\n0 0", "4\n1 2\n1 2\n2 1\n0 0", "1\n100000 0"]
2 seconds
["3", "2", "0"]
null
Java 8
standard input
[ "data structures", "ternary search" ]
2a0362376ddeaf3548d5419d1e70b4d3
First line contains one integer n (1 ≀ n ≀ 105) β€” number of voters in the city. Each of the next n lines describes one voter and contains two integers ai and bi (0 ≀ ai ≀ 105;Β 0 ≀ bi ≀ 104) β€” number of the candidate that voter is going to vote for and amount of money you need to pay him to change his mind. You are the ...
2,100
Print one integer β€” smallest amount of money you need to spend to win the elections.
standard output
PASSED
b41641cf66543bf3c4e2639607374455
train_000.jsonl
1407690000
You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he will vote for, and how much it will cost to bribe that person to vote for you instead of whomever he wants to vote for right now. You are curious, what is the smallest am...
256 megabytes
import java.io.*; import java.util.*; public class Main { FastReader scn; PrintWriter out; String INPUT = ""; void solve() { int n = scn.nextInt(), m = 0; int[] from = new int[n], to = new int[n]; for(int i = 0; i < n; i++) { from[i] = scn.nextInt(); to[i] = scn.nextInt(); m = Math.max(m, from[i] +...
Java
["5\n1 2\n1 2\n1 2\n2 1\n0 0", "4\n1 2\n1 2\n2 1\n0 0", "1\n100000 0"]
2 seconds
["3", "2", "0"]
null
Java 8
standard input
[ "data structures", "ternary search" ]
2a0362376ddeaf3548d5419d1e70b4d3
First line contains one integer n (1 ≀ n ≀ 105) β€” number of voters in the city. Each of the next n lines describes one voter and contains two integers ai and bi (0 ≀ ai ≀ 105;Β 0 ≀ bi ≀ 104) β€” number of the candidate that voter is going to vote for and amount of money you need to pay him to change his mind. You are the ...
2,100
Print one integer β€” smallest amount of money you need to spend to win the elections.
standard output
PASSED
12e2bfa8881b30c73a938bb4756bbe2f
train_000.jsonl
1407690000
You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he will vote for, and how much it will cost to bribe that person to vote for you instead of whomever he wants to vote for right now. You are curious, what is the smallest am...
256 megabytes
import java.util.LinkedList; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.AbstractSequentialList; import java.util.NoSuchElementException; import java.math.BigInteger; import java.io.OutputStream; import java.util.Iterator; import java.io.PrintWriter; import java.io.Writer; i...
Java
["5\n1 2\n1 2\n1 2\n2 1\n0 0", "4\n1 2\n1 2\n2 1\n0 0", "1\n100000 0"]
2 seconds
["3", "2", "0"]
null
Java 8
standard input
[ "data structures", "ternary search" ]
2a0362376ddeaf3548d5419d1e70b4d3
First line contains one integer n (1 ≀ n ≀ 105) β€” number of voters in the city. Each of the next n lines describes one voter and contains two integers ai and bi (0 ≀ ai ≀ 105;Β 0 ≀ bi ≀ 104) β€” number of the candidate that voter is going to vote for and amount of money you need to pay him to change his mind. You are the ...
2,100
Print one integer β€” smallest amount of money you need to spend to win the elections.
standard output
PASSED
814f1cfba15981d1ef846484125cb1e0
train_000.jsonl
1407690000
You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he will vote for, and how much it will cost to bribe that person to vote for you instead of whomever he wants to vote for right now. You are curious, what is the smallest am...
256 megabytes
import java.io.*; import java.util.*; public class C { public void solve() { int n = in.nextInt(); int our = 0; Map<Integer, List<Citizen>> voters = new HashMap<>(); List<Citizen> all = new ArrayList<>(); for (int i = 0; i < n; i++) { int a = in.nextInt(), b = in.nextInt(); if (a == 0) { our+...
Java
["5\n1 2\n1 2\n1 2\n2 1\n0 0", "4\n1 2\n1 2\n2 1\n0 0", "1\n100000 0"]
2 seconds
["3", "2", "0"]
null
Java 8
standard input
[ "data structures", "ternary search" ]
2a0362376ddeaf3548d5419d1e70b4d3
First line contains one integer n (1 ≀ n ≀ 105) β€” number of voters in the city. Each of the next n lines describes one voter and contains two integers ai and bi (0 ≀ ai ≀ 105;Β 0 ≀ bi ≀ 104) β€” number of the candidate that voter is going to vote for and amount of money you need to pay him to change his mind. You are the ...
2,100
Print one integer β€” smallest amount of money you need to spend to win the elections.
standard output
PASSED
2dcf6a78521efc73bf5805816e31c0fc
train_000.jsonl
1407690000
You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he will vote for, and how much it will cost to bribe that person to vote for you instead of whomever he wants to vote for right now. You are curious, what is the smallest am...
256 megabytes
import java.util.Arrays; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top * @author Rub...
Java
["5\n1 2\n1 2\n1 2\n2 1\n0 0", "4\n1 2\n1 2\n2 1\n0 0", "1\n100000 0"]
2 seconds
["3", "2", "0"]
null
Java 8
standard input
[ "data structures", "ternary search" ]
2a0362376ddeaf3548d5419d1e70b4d3
First line contains one integer n (1 ≀ n ≀ 105) β€” number of voters in the city. Each of the next n lines describes one voter and contains two integers ai and bi (0 ≀ ai ≀ 105;Β 0 ≀ bi ≀ 104) β€” number of the candidate that voter is going to vote for and amount of money you need to pay him to change his mind. You are the ...
2,100
Print one integer β€” smallest amount of money you need to spend to win the elections.
standard output
PASSED
81f3fc7ec4c4cf329330cb8ab019c2a1
train_000.jsonl
1407690000
You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he will vote for, and how much it will cost to bribe that person to vote for you instead of whomever he wants to vote for right now. You are curious, what is the smallest am...
256 megabytes
import java.io.*; import java.util.*; public class C { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; static class Voter implements Comparable<Voter> { int id, vote, cost; public Voter(int id, int vote, int cost) { this.id = id; this.vote = vote; this.cost = cost; } @Ove...
Java
["5\n1 2\n1 2\n1 2\n2 1\n0 0", "4\n1 2\n1 2\n2 1\n0 0", "1\n100000 0"]
2 seconds
["3", "2", "0"]
null
Java 8
standard input
[ "data structures", "ternary search" ]
2a0362376ddeaf3548d5419d1e70b4d3
First line contains one integer n (1 ≀ n ≀ 105) β€” number of voters in the city. Each of the next n lines describes one voter and contains two integers ai and bi (0 ≀ ai ≀ 105;Β 0 ≀ bi ≀ 104) β€” number of the candidate that voter is going to vote for and amount of money you need to pay him to change his mind. You are the ...
2,100
Print one integer β€” smallest amount of money you need to spend to win the elections.
standard output
PASSED
1eee946071b75afd4629c4505b57d6e7
train_000.jsonl
1407690000
You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he will vote for, and how much it will cost to bribe that person to vote for you instead of whomever he wants to vote for right now. You are curious, what is the smallest am...
256 megabytes
import java.util.Arrays; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Comparator; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution...
Java
["5\n1 2\n1 2\n1 2\n2 1\n0 0", "4\n1 2\n1 2\n2 1\n0 0", "1\n100000 0"]
2 seconds
["3", "2", "0"]
null
Java 8
standard input
[ "data structures", "ternary search" ]
2a0362376ddeaf3548d5419d1e70b4d3
First line contains one integer n (1 ≀ n ≀ 105) β€” number of voters in the city. Each of the next n lines describes one voter and contains two integers ai and bi (0 ≀ ai ≀ 105;Β 0 ≀ bi ≀ 104) β€” number of the candidate that voter is going to vote for and amount of money you need to pay him to change his mind. You are the ...
2,100
Print one integer β€” smallest amount of money you need to spend to win the elections.
standard output
PASSED
7b6dcbcc2b2a45a606180c60f4d908e5
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.util.*; import java.awt.geom.*; public class Main{ public static void main(String[] args){ Scanner ir=new Scanner(System.in); int n=ir.nextInt(); double X=ir.nextDouble(),Y=ir.nextDouble(); double[] x=new double[n],y=new double[n]; double ma=0.0,mi=1e18; for(int i=0;i<n;i++){ x[i]=ir.nextDo...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
f859550592c79ac32da1cc863f464b07
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.InputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; import java.awt.geom.*; import java.text.De...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
46eaefe0be0bc01c53a799dc6f5afe03
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(); long px = in.nextLong(), py = in.nextLong(); long[] x = new long[n], y = new long[n]; double min = Double.POSITIVE_INFINITY, max = Double...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
f4f78a1e3b6f4ffc3889718ed674238c
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.util.*; import java.awt.geom.*; /** * Problem statement: http://codeforces.com/problemset/problem/614/C */ public class FindTheBug9 { private static class Point { private int x; private int y; Point(int x, int y) { this.x = x; this.y = y; } ...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
38ca7382eae6fddd4074e202ca93f525
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.awt.*; import java.awt.geom.*; import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.stream.Collector; /** * Created by ribra on 11/15/2015. */ public class Main { private static InputReader sc = new InputReader(System.in); private static PrintWriter pw = new PrintW...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
ef027fb1cf87f02521917389cb0f5eb9
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
/** * Created by Anna on 18.01.2016. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class TaskC { BufferedReader in; PrintWriter out; StringTokenizer st; public static void main(Str...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
e19c3e36d113e03b22c523caaab7ddc1
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); ...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
47463a779118e55a7129858d056b0b0d
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.awt.geom.Line2D; import java.io.*; import java.util.*; public class C { public static void solution(BufferedReader reader, PrintWriter out) throws IOException { In in = new In(reader); int n = in.nextInt(); px = in.nextDouble(); py = in.nextDouble(); ...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
37ef426eaf50b19dd0e8172a66475db4
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.util.*; /** * Problem statement: http://codeforces.com/problemset/problem/614/C */ public class FindTheBug9 { private static class Point { private long x; private long y; Point(long x, long y) { this.x = x; this.y = y; } double norm2(...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
897199518a49fc18c8bc73cd915486f5
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; /** * Created by Shahjahan on 6/22/2017. * http://codeforces.com/contest/614/problem/C */ public class C614_C { public static void...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
6688486335b75bbd4c8ca8a31f1eb115
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; /** * Created by Shahjahan on 6/22/2017. * http://codeforces.com/contest/614/problem/C */ public class C614_C { public static void main(String[] args) throws IOException { BufferedRea...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
8c88b65a603b0764fe0f8e820aae0fac
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.awt.geom.Line2D; import java.util.Scanner; public class CF_614C { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(), px = scan.nextInt(), py = scan.nextInt(); double minRadius = Double.MAX_VALUE; double maxRadius = -1; Point[] pts = new Po...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
5373dec28d9cea27cecd1d9de08ca8ba
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.util.*; public class Main { int N; P origin; P[] ps; private class P{ double x,y; public P(double x,double y){ this.x = x; this.y = y; } } public double di...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
49d0d6de9d1a88daa5bfd388ee6f69ff
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.*; import java.util.InputMismatchException; public class Main { private static InputReader ir; private static OutputWriter ow; final static int INF = Integer.MAX_VALUE; public static void main(String[] args) throws Exception { initS(); //initF("INPUT.TXT", "OUTPUT.TXT")...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
6c62cbaddae55256914f297d48bb969d
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.util.*; /** * Problem statement: http://codeforces.com/problemset/problem/614/C */ public class FindTheBug9 { private static class Point { private long x; private long y; Point(long x, long y) { this.x = x; this.y = y; } double norm2(...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
8a795faf02f09144fdd55801f6b4e897
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.awt.geom.Line2D; import java.util.*; /** * Problem statement: http://codeforces.com/problemset/problem/614/C */ public class FindTheBug9 { private static class Point { private double x; private double y; Point(double x, double y) { this.x = x; this.y ...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
62cef2c508c68d29674fc16bc9d441ca
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.regex.Matcher; import java.util.regex.Pattern; public class PetersSnow { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
64e6e54518931d70b89378c89049935d
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.*; import java.text.DecimalFormat; import java.util.StringTokenizer; public class Main { static final double eps = 1e-6; public static void main(String[] args) throws Exception { Reader in = new Reader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new Out...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
cb9738ccc0dbd16e9b3e114fbed18f27
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.util.Scanner; public class C { private static final int UNDEF = Integer.MAX_VALUE; private static double max = 0; private static double min = Double.MAX_VALUE; private static long cx; private static long cy; public static void main(String[] args) { Scanner s = new Scanner...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
f1c93bdd59d48b50d27d97f60fd2f494
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import static java.lang.Math.*; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Double.parseDouble; import static java.lang.String.*; public class Main { public static void main(Stri...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
ccfbf5d88cd027256b08d68359cdda78
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.util.*; import java.io.*; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.awt.geom.Point2D.Double; public class c { public static void main(String[] arg) { new c(); } public c() { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n =...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
715989482ada2f81c7ce6e9f48528f13
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.util.*; import java.io.*; import java.awt.geom.Line2D; import java.awt.geom.Point2D; public class c { public static void main(String[] arg) throws IOException { new c(); } public c() throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); ...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
ab2f30c97cd4604948466466c477b1e3
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Don Li */ public class SnowBlower { static final int INF = (int) 1e9; void solve() { int n = in.nextInt(); long a = in.nex...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
b36f610137bea14851f81599b21bce81
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Don Li */ public class SnowBlower { static final int INF = (int) 1e9; void solve() { int n = in.nextInt(); long a = in.nex...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
078901e376cc987e8414ac7427cc69d3
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
/** * * @author meashish */ import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.PrintStream; import java.io.Serializable; import java.math.BigInteger; import java.util.Arrays; import java.util.Comparator; import java.util.InputMism...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
266e5b28b66b94433cc4bf855a0c38db
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.BufferedReader; import java.util.regex.Pattern; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
0cbd312d2d35b019cd0bc31c5e54cf85
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.awt.Point; import java.util.*; import java.math.*; import java.awt.geom.*; /** * * @author sarthak */ public class rnd339_C { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int px=s.nextInt(); int py=s.nextInt(); ...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
948f3e6d06072e7e586d8abd1af719fb
train_000.jsonl
1452789300
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you need to tie it to some point that it does not cover, and then switch it on. As a result it...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main{ BufferedReader buf; PrintWriter out; class Pt{ double x,y; Pt(double x, double y) { super(); this.x = x; this.y = y; } double dist(Pt to){ return Math.sqrt( (to.x-this.x)*(to.x-this.x) + (to.y-this.y)*(to.y-th...
Java
["3 0 0\n0 1\n-1 2\n1 2", "4 1 -1\n0 0\n1 2\n2 0\n1 1"]
2 seconds
["12.566370614359172464", "21.991148575128551812"]
NoteIn the first sample snow will be removed from that area:
Java 8
standard input
[ "geometry" ]
1d547a38250c7780ddcf10674417d5ff
The first line of the input contains three integersΒ β€” the number of vertices of the polygon n (), and coordinates of point P. Each of the next n lines contains two integersΒ β€” coordinates of the vertices of the polygon in the clockwise or counterclockwise order. It is guaranteed that no three consecutive vertices lie on...
1,900
Print a single real value numberΒ β€” the area of the region that will be cleared. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6. Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .
standard output
PASSED
245d3387f5edc1f4eb249a133a9f7079
train_000.jsonl
1358091000
Maxim has opened his own restaurant! The restaurant has got a huge table, the table's length is p meters.Maxim has got a dinner party tonight, n guests will come to him. Let's index the guests of Maxim's restaurant from 1 to n. Maxim knows the sizes of all guests that are going to come to him. The i-th guest's size (ai...
256 megabytes
import java.util.*; public class D { static final int MAX = 50; static int [] a; static int n; static int p; static double [][] c; static { c = new double[MAX + 1][MAX + 1]; c[0][0] = 1; for (int i = 1; i <= MAX; ++i){ c[i][0] = 1; for (int j = 1; j <= i; ++j){ c[i][j] = c[i - 1][j] + c[i - 1][j ...
Java
["3\n1 2 3\n3"]
2 seconds
["1.3333333333"]
NoteIn the first sample the people will come in the following orders: (1, 2, 3) β€” there will be two people in the restaurant; (1, 3, 2) β€” there will be one person in the restaurant; (2, 1, 3) β€” there will be two people in the restaurant; (2, 3, 1) β€” there will be one person in the restaurant; (3, 1, 2) β€” there wi...
Java 7
standard input
[ "dp", "combinatorics" ]
b64f1667a8fd29d1de81414259a626c9
The first line contains integer n (1 ≀ n ≀ 50) β€” the number of guests in the restaurant. The next line contains integers a1, a2, ..., an (1 ≀ ai ≀ 50) β€” the guests' sizes in meters. The third line contains integer p (1 ≀ p ≀ 50) β€” the table's length in meters. The numbers in the lines are separated by single spaces.
1,900
In a single line print a real number β€” the answer to the problem. The answer will be considered correct, if the absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
d03a1d9d9c8ab3b4d14df72292eecfa6
train_000.jsonl
1358091000
Maxim has opened his own restaurant! The restaurant has got a huge table, the table's length is p meters.Maxim has got a dinner party tonight, n guests will come to him. Let's index the guests of Maxim's restaurant from 1 to n. Maxim knows the sizes of all guests that are going to come to him. The i-th guest's size (ai...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.IOException; import java.math.BigDecimal; import java.util.Scanner; /** * * @author psergiol */ public class Main { /** * @param args the command line arguments */ public static Bi...
Java
["3\n1 2 3\n3"]
2 seconds
["1.3333333333"]
NoteIn the first sample the people will come in the following orders: (1, 2, 3) β€” there will be two people in the restaurant; (1, 3, 2) β€” there will be one person in the restaurant; (2, 1, 3) β€” there will be two people in the restaurant; (2, 3, 1) β€” there will be one person in the restaurant; (3, 1, 2) β€” there wi...
Java 7
standard input
[ "dp", "combinatorics" ]
b64f1667a8fd29d1de81414259a626c9
The first line contains integer n (1 ≀ n ≀ 50) β€” the number of guests in the restaurant. The next line contains integers a1, a2, ..., an (1 ≀ ai ≀ 50) β€” the guests' sizes in meters. The third line contains integer p (1 ≀ p ≀ 50) β€” the table's length in meters. The numbers in the lines are separated by single spaces.
1,900
In a single line print a real number β€” the answer to the problem. The answer will be considered correct, if the absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
491a2e1f3c4a1dfaaeba2922fe9b773c
train_000.jsonl
1358091000
Maxim has opened his own restaurant! The restaurant has got a huge table, the table's length is p meters.Maxim has got a dinner party tonight, n guests will come to him. Let's index the guests of Maxim's restaurant from 1 to n. Maxim knows the sizes of all guests that are going to come to him. The i-th guest's size (ai...
256 megabytes
import java.math.BigDecimal; import java.math.BigInteger; import java.util.Scanner; public class Main { public static int arr[] = new int[51]; public static int n, p, x, cnt; public static BigDecimal fact[] = new BigDecimal[51]; public static double mem[][][][] = new double[2][51][51][51]; public...
Java
["3\n1 2 3\n3"]
2 seconds
["1.3333333333"]
NoteIn the first sample the people will come in the following orders: (1, 2, 3) β€” there will be two people in the restaurant; (1, 3, 2) β€” there will be one person in the restaurant; (2, 1, 3) β€” there will be two people in the restaurant; (2, 3, 1) β€” there will be one person in the restaurant; (3, 1, 2) β€” there wi...
Java 7
standard input
[ "dp", "combinatorics" ]
b64f1667a8fd29d1de81414259a626c9
The first line contains integer n (1 ≀ n ≀ 50) β€” the number of guests in the restaurant. The next line contains integers a1, a2, ..., an (1 ≀ ai ≀ 50) β€” the guests' sizes in meters. The third line contains integer p (1 ≀ p ≀ 50) β€” the table's length in meters. The numbers in the lines are separated by single spaces.
1,900
In a single line print a real number β€” the answer to the problem. The answer will be considered correct, if the absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
40aea1beaca839f58fab7a299ab92ea1
train_000.jsonl
1358091000
Maxim has opened his own restaurant! The restaurant has got a huge table, the table's length is p meters.Maxim has got a dinner party tonight, n guests will come to him. Let's index the guests of Maxim's restaurant from 1 to n. Maxim knows the sizes of all guests that are going to come to him. The i-th guest's size (ai...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchEx...
Java
["3\n1 2 3\n3"]
2 seconds
["1.3333333333"]
NoteIn the first sample the people will come in the following orders: (1, 2, 3) β€” there will be two people in the restaurant; (1, 3, 2) β€” there will be one person in the restaurant; (2, 1, 3) β€” there will be two people in the restaurant; (2, 3, 1) β€” there will be one person in the restaurant; (3, 1, 2) β€” there wi...
Java 7
standard input
[ "dp", "combinatorics" ]
b64f1667a8fd29d1de81414259a626c9
The first line contains integer n (1 ≀ n ≀ 50) β€” the number of guests in the restaurant. The next line contains integers a1, a2, ..., an (1 ≀ ai ≀ 50) β€” the guests' sizes in meters. The third line contains integer p (1 ≀ p ≀ 50) β€” the table's length in meters. The numbers in the lines are separated by single spaces.
1,900
In a single line print a real number β€” the answer to the problem. The answer will be considered correct, if the absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
b4eacd3d555ac0105257a01d4be86b7c
train_000.jsonl
1358091000
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all integers in sequence. Roma decided to perform exactly k changes of signs of several...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { private static Scanner scanner = new Scanner(System.in); private static int OO = (int) 1e9 + 9, r; private static int[] dx = {0, 0, 1, -1}; private static int[] dy = {1, -1, 0, 0}; private static int[] arr = new int[32]; pu...
Java
["3 2\n-1 -1 1", "3 1\n-1 -1 1"]
2 seconds
["3", "1"]
NoteIn the first sample we can get sequence [1, 1, 1], thus the total income equals 3.In the second test, the optimal strategy is to get sequence [-1, 1, 1], thus the total income equals 1.
Java 11
standard input
[ "greedy" ]
befd3b1b4afe19ff619c0b34ed1a4966
The first line contains two integers n and k (1 ≀ n, k ≀ 105), showing, how many numbers are in the sequence and how many swaps are to be made. The second line contains a non-decreasing sequence, consisting of n integers ai (|ai| ≀ 104). The numbers in the lines are separated by single spaces. Please note that the give...
1,200
In the single line print the answer to the problem β€” the maximum total income that we can obtain after exactly k changes.
standard output
PASSED
8ce56cdf8fe21f5b3315ae26d5fed12c
train_000.jsonl
1358091000
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all integers in sequence. Roma decided to perform exactly k changes of signs of several...
256 megabytes
import java.util.*; public class Prob87{ public static long compute(Vector<Integer> v , int count,int k){ if(count == 0){ int min = v.elementAt(0); int temp = min; min =min * (int)Math.pow((double)-1,k); if(min != temp){ v.add(min); ...
Java
["3 2\n-1 -1 1", "3 1\n-1 -1 1"]
2 seconds
["3", "1"]
NoteIn the first sample we can get sequence [1, 1, 1], thus the total income equals 3.In the second test, the optimal strategy is to get sequence [-1, 1, 1], thus the total income equals 1.
Java 11
standard input
[ "greedy" ]
befd3b1b4afe19ff619c0b34ed1a4966
The first line contains two integers n and k (1 ≀ n, k ≀ 105), showing, how many numbers are in the sequence and how many swaps are to be made. The second line contains a non-decreasing sequence, consisting of n integers ai (|ai| ≀ 104). The numbers in the lines are separated by single spaces. Please note that the give...
1,200
In the single line print the answer to the problem β€” the maximum total income that we can obtain after exactly k changes.
standard output
PASSED
d8970969ad11caa70beaf2962b7bb437
train_000.jsonl
1358091000
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all integers in sequence. Roma decided to perform exactly k changes of signs of several...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class practice{ static Scanner sc = new Scanner(System.in); public static int[] read(int n) { int[] arr= new int[n]; for(int i=0;i<n;++i) { arr[i]=sc.nextInt(); } return arr; } public static int function(int n,int k,int[] arr) { int ans=0...
Java
["3 2\n-1 -1 1", "3 1\n-1 -1 1"]
2 seconds
["3", "1"]
NoteIn the first sample we can get sequence [1, 1, 1], thus the total income equals 3.In the second test, the optimal strategy is to get sequence [-1, 1, 1], thus the total income equals 1.
Java 11
standard input
[ "greedy" ]
befd3b1b4afe19ff619c0b34ed1a4966
The first line contains two integers n and k (1 ≀ n, k ≀ 105), showing, how many numbers are in the sequence and how many swaps are to be made. The second line contains a non-decreasing sequence, consisting of n integers ai (|ai| ≀ 104). The numbers in the lines are separated by single spaces. Please note that the give...
1,200
In the single line print the answer to the problem β€” the maximum total income that we can obtain after exactly k changes.
standard output
PASSED
9b9a19cad54174f5ddee354311aa1332
train_000.jsonl
1358091000
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all integers in sequence. Roma decided to perform exactly k changes of signs of several...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); ...
Java
["3 2\n-1 -1 1", "3 1\n-1 -1 1"]
2 seconds
["3", "1"]
NoteIn the first sample we can get sequence [1, 1, 1], thus the total income equals 3.In the second test, the optimal strategy is to get sequence [-1, 1, 1], thus the total income equals 1.
Java 11
standard input
[ "greedy" ]
befd3b1b4afe19ff619c0b34ed1a4966
The first line contains two integers n and k (1 ≀ n, k ≀ 105), showing, how many numbers are in the sequence and how many swaps are to be made. The second line contains a non-decreasing sequence, consisting of n integers ai (|ai| ≀ 104). The numbers in the lines are separated by single spaces. Please note that the give...
1,200
In the single line print the answer to the problem β€” the maximum total income that we can obtain after exactly k changes.
standard output
PASSED
a68e2c857c47dc15e2bd367913a60676
train_000.jsonl
1358091000
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all integers in sequence. Roma decided to perform exactly k changes of signs of several...
256 megabytes
import java.util.*; public class romaAndChangingSigns1 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int a[]=new int[n]; long sum=0; for(int i=0;i<n;i++) { a[i]=sc.nextInt(); } Arrays.sort(a); for(int i=0;i<n;i++) { i...
Java
["3 2\n-1 -1 1", "3 1\n-1 -1 1"]
2 seconds
["3", "1"]
NoteIn the first sample we can get sequence [1, 1, 1], thus the total income equals 3.In the second test, the optimal strategy is to get sequence [-1, 1, 1], thus the total income equals 1.
Java 11
standard input
[ "greedy" ]
befd3b1b4afe19ff619c0b34ed1a4966
The first line contains two integers n and k (1 ≀ n, k ≀ 105), showing, how many numbers are in the sequence and how many swaps are to be made. The second line contains a non-decreasing sequence, consisting of n integers ai (|ai| ≀ 104). The numbers in the lines are separated by single spaces. Please note that the give...
1,200
In the single line print the answer to the problem β€” the maximum total income that we can obtain after exactly k changes.
standard output
PASSED
87cc8bcc4ee6ad33a3c4c5211ece3cf1
train_000.jsonl
1580308500
An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $$$n$$$ problems; and since the platform is very popular, $$$998244351$$$ coder from all over the world is going to solve them.For each problem, the authors estimated the number of people who would so...
256 megabytes
/** * BaZ :D */ import java.util.*; import java.io.*; import static java.lang.Math.*; public class ACMIND { static FastReader scan; static PrintWriter pw; static long MOD = 998244353; static long INF = 1_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main(Strin...
Java
["3\n1 2\n1 2\n1 2", "2\n42 1337\n13 420", "2\n1 1\n0 0", "2\n1 1\n1 1"]
3 seconds
["499122177", "578894053", "1", "1"]
NoteThe real answer in the first test is $$$\frac{1}{2}$$$.
Java 8
standard input
[ "dp", "combinatorics", "probabilities" ]
075249e446f34d1e88245ea3a1ab0768
The first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$) β€” the number of problems in the contest. Then $$$n$$$ lines follow, the $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$0 \le l_i \le r_i \le 998244351$$$) β€” the minimum and maximum number of accepted solutions for the $$$i$$$-th probl...
2,700
The probability that there will be no inversions in the contest can be expressed as an irreducible fraction $$$\frac{x}{y}$$$, where $$$y$$$ is coprime with $$$998244353$$$. Print one integer β€” the value of $$$xy^{-1}$$$, taken modulo $$$998244353$$$, where $$$y^{-1}$$$ is an integer such that $$$yy^{-1} \equiv 1$$$ $$...
standard output
PASSED
b6c5d793c2e2b77012c6b60282e6acd4
train_000.jsonl
1580308500
An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $$$n$$$ problems; and since the platform is very popular, $$$998244351$$$ coder from all over the world is going to solve them.For each problem, the authors estimated the number of people who would so...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class f { class DSU { int[] p; public DSU(int n) { p = new int[n]; for(int i = 0 ; i < n ; i++) p[i] = i; } int find(int x) { return x == p[x] ? x : (p[x] = find(p[x])); } boolean union(int u, int v) { int p1 = find(u), p2 = find(v); ...
Java
["3\n1 2\n1 2\n1 2", "2\n42 1337\n13 420", "2\n1 1\n0 0", "2\n1 1\n1 1"]
3 seconds
["499122177", "578894053", "1", "1"]
NoteThe real answer in the first test is $$$\frac{1}{2}$$$.
Java 8
standard input
[ "dp", "combinatorics", "probabilities" ]
075249e446f34d1e88245ea3a1ab0768
The first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$) β€” the number of problems in the contest. Then $$$n$$$ lines follow, the $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$0 \le l_i \le r_i \le 998244351$$$) β€” the minimum and maximum number of accepted solutions for the $$$i$$$-th probl...
2,700
The probability that there will be no inversions in the contest can be expressed as an irreducible fraction $$$\frac{x}{y}$$$, where $$$y$$$ is coprime with $$$998244353$$$. Print one integer β€” the value of $$$xy^{-1}$$$, taken modulo $$$998244353$$$, where $$$y^{-1}$$$ is an integer such that $$$yy^{-1} \equiv 1$$$ $$...
standard output
PASSED
358406266e9b84ecb9d199f4dab0f5d5
train_000.jsonl
1580308500
An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $$$n$$$ problems; and since the platform is very popular, $$$998244351$$$ coder from all over the world is going to solve them.For each problem, the authors estimated the number of people who would so...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class f { class DSU { int[] p; public DSU(int n) { p = new int[n]; for(int i = 0 ; i < n ; i++) p[i] = i; } int find(int x) { return x == p[x] ? x : (p[x] = find(p[x])); } boolean union(int u, int v) { int p1 = find(u), p2 = find(...
Java
["3\n1 2\n1 2\n1 2", "2\n42 1337\n13 420", "2\n1 1\n0 0", "2\n1 1\n1 1"]
3 seconds
["499122177", "578894053", "1", "1"]
NoteThe real answer in the first test is $$$\frac{1}{2}$$$.
Java 8
standard input
[ "dp", "combinatorics", "probabilities" ]
075249e446f34d1e88245ea3a1ab0768
The first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$) β€” the number of problems in the contest. Then $$$n$$$ lines follow, the $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$0 \le l_i \le r_i \le 998244351$$$) β€” the minimum and maximum number of accepted solutions for the $$$i$$$-th probl...
2,700
The probability that there will be no inversions in the contest can be expressed as an irreducible fraction $$$\frac{x}{y}$$$, where $$$y$$$ is coprime with $$$998244353$$$. Print one integer β€” the value of $$$xy^{-1}$$$, taken modulo $$$998244353$$$, where $$$y^{-1}$$$ is an integer such that $$$yy^{-1} \equiv 1$$$ $$...
standard output
PASSED
f9ef73dab0034a620a972344721da821
train_000.jsonl
1580308500
An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $$$n$$$ problems; and since the platform is very popular, $$$998244351$$$ coder from all over the world is going to solve them.For each problem, the authors estimated the number of people who would so...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class f { long modinv(long x) { return modpow(x, mod - 2); } long modpow(long b, long e) { if(e == 0) return 1; long r = modpow(b, e >> 1); if((e & 1) == 0) return mult(r, r); return mult(b, mult(r, r)); } long add(long a, long b) { return a ...
Java
["3\n1 2\n1 2\n1 2", "2\n42 1337\n13 420", "2\n1 1\n0 0", "2\n1 1\n1 1"]
3 seconds
["499122177", "578894053", "1", "1"]
NoteThe real answer in the first test is $$$\frac{1}{2}$$$.
Java 8
standard input
[ "dp", "combinatorics", "probabilities" ]
075249e446f34d1e88245ea3a1ab0768
The first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$) β€” the number of problems in the contest. Then $$$n$$$ lines follow, the $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$0 \le l_i \le r_i \le 998244351$$$) β€” the minimum and maximum number of accepted solutions for the $$$i$$$-th probl...
2,700
The probability that there will be no inversions in the contest can be expressed as an irreducible fraction $$$\frac{x}{y}$$$, where $$$y$$$ is coprime with $$$998244353$$$. Print one integer β€” the value of $$$xy^{-1}$$$, taken modulo $$$998244353$$$, where $$$y^{-1}$$$ is an integer such that $$$yy^{-1} \equiv 1$$$ $$...
standard output
PASSED
566f60fe721bc405103e4abd9373ce39
train_000.jsonl
1580308500
An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $$$n$$$ problems; and since the platform is very popular, $$$998244351$$$ coder from all over the world is going to solve them.For each problem, the authors estimated the number of people who would so...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.HashMap; import java.util.ArrayList; import java.util.Map; import java.io.OutputStreamWriter; import java.io.OutputStream; import java.util.Collection; import java.io.IOException; import java.u...
Java
["3\n1 2\n1 2\n1 2", "2\n42 1337\n13 420", "2\n1 1\n0 0", "2\n1 1\n1 1"]
3 seconds
["499122177", "578894053", "1", "1"]
NoteThe real answer in the first test is $$$\frac{1}{2}$$$.
Java 8
standard input
[ "dp", "combinatorics", "probabilities" ]
075249e446f34d1e88245ea3a1ab0768
The first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$) β€” the number of problems in the contest. Then $$$n$$$ lines follow, the $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$0 \le l_i \le r_i \le 998244351$$$) β€” the minimum and maximum number of accepted solutions for the $$$i$$$-th probl...
2,700
The probability that there will be no inversions in the contest can be expressed as an irreducible fraction $$$\frac{x}{y}$$$, where $$$y$$$ is coprime with $$$998244353$$$. Print one integer β€” the value of $$$xy^{-1}$$$, taken modulo $$$998244353$$$, where $$$y^{-1}$$$ is an integer such that $$$yy^{-1} \equiv 1$$$ $$...
standard output
PASSED
706624e0d3240497ecc0dd720f6e0c7e
train_000.jsonl
1580308500
An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $$$n$$$ problems; and since the platform is very popular, $$$998244351$$$ coder from all over the world is going to solve them.For each problem, the authors estimated the number of people who would so...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.HashMap; import java.util.ArrayList; import java.util.Map; import java.io.OutputStreamWriter; import java.io.OutputStream; import java.util.Collection; import java.io.IOException; import java.u...
Java
["3\n1 2\n1 2\n1 2", "2\n42 1337\n13 420", "2\n1 1\n0 0", "2\n1 1\n1 1"]
3 seconds
["499122177", "578894053", "1", "1"]
NoteThe real answer in the first test is $$$\frac{1}{2}$$$.
Java 8
standard input
[ "dp", "combinatorics", "probabilities" ]
075249e446f34d1e88245ea3a1ab0768
The first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$) β€” the number of problems in the contest. Then $$$n$$$ lines follow, the $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$0 \le l_i \le r_i \le 998244351$$$) β€” the minimum and maximum number of accepted solutions for the $$$i$$$-th probl...
2,700
The probability that there will be no inversions in the contest can be expressed as an irreducible fraction $$$\frac{x}{y}$$$, where $$$y$$$ is coprime with $$$998244353$$$. Print one integer β€” the value of $$$xy^{-1}$$$, taken modulo $$$998244353$$$, where $$$y^{-1}$$$ is an integer such that $$$yy^{-1} \equiv 1$$$ $$...
standard output
PASSED
b184e1edc499e50ab94acdd4a0497e87
train_000.jsonl
1580308500
An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $$$n$$$ problems; and since the platform is very popular, $$$998244351$$$ coder from all over the world is going to solve them.For each problem, the authors estimated the number of people who would so...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.util.Random; import java.util.ArrayList; import java.io.UncheckedIOException; import java.util.List; import java.io.Closeable; import java.io...
Java
["3\n1 2\n1 2\n1 2", "2\n42 1337\n13 420", "2\n1 1\n0 0", "2\n1 1\n1 1"]
3 seconds
["499122177", "578894053", "1", "1"]
NoteThe real answer in the first test is $$$\frac{1}{2}$$$.
Java 8
standard input
[ "dp", "combinatorics", "probabilities" ]
075249e446f34d1e88245ea3a1ab0768
The first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$) β€” the number of problems in the contest. Then $$$n$$$ lines follow, the $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$0 \le l_i \le r_i \le 998244351$$$) β€” the minimum and maximum number of accepted solutions for the $$$i$$$-th probl...
2,700
The probability that there will be no inversions in the contest can be expressed as an irreducible fraction $$$\frac{x}{y}$$$, where $$$y$$$ is coprime with $$$998244353$$$. Print one integer β€” the value of $$$xy^{-1}$$$, taken modulo $$$998244353$$$, where $$$y^{-1}$$$ is an integer such that $$$yy^{-1} \equiv 1$$$ $$...
standard output
PASSED
8c67b4fa037a4d41b365c6c37533d0f7
train_000.jsonl
1580308500
An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $$$n$$$ problems; and since the platform is very popular, $$$998244351$$$ coder from all over the world is going to solve them.For each problem, the authors estimated the number of people who would so...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.util.Random; import java.util.ArrayList; import java.io.UncheckedIOException; import java.util.List; import java.io.Closeable; import java.io...
Java
["3\n1 2\n1 2\n1 2", "2\n42 1337\n13 420", "2\n1 1\n0 0", "2\n1 1\n1 1"]
3 seconds
["499122177", "578894053", "1", "1"]
NoteThe real answer in the first test is $$$\frac{1}{2}$$$.
Java 8
standard input
[ "dp", "combinatorics", "probabilities" ]
075249e446f34d1e88245ea3a1ab0768
The first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$) β€” the number of problems in the contest. Then $$$n$$$ lines follow, the $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$0 \le l_i \le r_i \le 998244351$$$) β€” the minimum and maximum number of accepted solutions for the $$$i$$$-th probl...
2,700
The probability that there will be no inversions in the contest can be expressed as an irreducible fraction $$$\frac{x}{y}$$$, where $$$y$$$ is coprime with $$$998244353$$$. Print one integer β€” the value of $$$xy^{-1}$$$, taken modulo $$$998244353$$$, where $$$y^{-1}$$$ is an integer such that $$$yy^{-1} \equiv 1$$$ $$...
standard output
PASSED
596c247c2436547f5c4fb2e1370fd3db
train_000.jsonl
1580308500
An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $$$n$$$ problems; and since the platform is very popular, $$$998244351$$$ coder from all over the world is going to solve them.For each problem, the authors estimated the number of people who would so...
256 megabytes
import java.util.*; import java.io.*; import java.text.*; public class Main{ //SOLUTION BEGIN //Into the Hardware Mode void pre() throws Exception{ } void solve(int TC)throws Exception { int n = ni(); long[][] rng = new long[1+n][]; TreeSet<Long> set = new TreeSet<>(); fo...
Java
["3\n1 2\n1 2\n1 2", "2\n42 1337\n13 420", "2\n1 1\n0 0", "2\n1 1\n1 1"]
3 seconds
["499122177", "578894053", "1", "1"]
NoteThe real answer in the first test is $$$\frac{1}{2}$$$.
Java 8
standard input
[ "dp", "combinatorics", "probabilities" ]
075249e446f34d1e88245ea3a1ab0768
The first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$) β€” the number of problems in the contest. Then $$$n$$$ lines follow, the $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$0 \le l_i \le r_i \le 998244351$$$) β€” the minimum and maximum number of accepted solutions for the $$$i$$$-th probl...
2,700
The probability that there will be no inversions in the contest can be expressed as an irreducible fraction $$$\frac{x}{y}$$$, where $$$y$$$ is coprime with $$$998244353$$$. Print one integer β€” the value of $$$xy^{-1}$$$, taken modulo $$$998244353$$$, where $$$y^{-1}$$$ is an integer such that $$$yy^{-1} \equiv 1$$$ $$...
standard output
PASSED
2da45a82d999bd8459f03bc358f4403c
train_000.jsonl
1580308500
An online contest will soon be held on ForceCoders, a large competitive programming platform. The authors have prepared $$$n$$$ problems; and since the platform is very popular, $$$998244351$$$ coder from all over the world is going to solve them.For each problem, the authors estimated the number of people who would so...
256 megabytes
//package educational.round81; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class F { InputStream is; PrintWriter out; String INPUT = ""; // 1/2 1/2 // 1/2 1/2...
Java
["3\n1 2\n1 2\n1 2", "2\n42 1337\n13 420", "2\n1 1\n0 0", "2\n1 1\n1 1"]
3 seconds
["499122177", "578894053", "1", "1"]
NoteThe real answer in the first test is $$$\frac{1}{2}$$$.
Java 8
standard input
[ "dp", "combinatorics", "probabilities" ]
075249e446f34d1e88245ea3a1ab0768
The first line contains one integer $$$n$$$ ($$$2 \le n \le 50$$$) β€” the number of problems in the contest. Then $$$n$$$ lines follow, the $$$i$$$-th line contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$0 \le l_i \le r_i \le 998244351$$$) β€” the minimum and maximum number of accepted solutions for the $$$i$$$-th probl...
2,700
The probability that there will be no inversions in the contest can be expressed as an irreducible fraction $$$\frac{x}{y}$$$, where $$$y$$$ is coprime with $$$998244353$$$. Print one integer β€” the value of $$$xy^{-1}$$$, taken modulo $$$998244353$$$, where $$$y^{-1}$$$ is an integer such that $$$yy^{-1} \equiv 1$$$ $$...
standard output
PASSED
a927e3af5f7f5fe128260f24d34910d0
train_000.jsonl
1537454700
Vasya owns three big integers β€” $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll...
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
["135\n1\n15", "10000\n0\n9"]
1 second
["2", "1"]
NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$.
Java 8
standard input
[ "dp", "hashing", "data structures", "binary search", "strings" ]
0d212ea4fc9f03fdd682289fca9b517e
The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co...
2,600
Print a single integer β€” the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$.
standard output
PASSED
26114dc70624b09dbece8c25b13c3157
train_000.jsonl
1537454700
Vasya owns three big integers β€” $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll...
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; public class dk { static int mod = 998244353; public static void main(String[] args) throws NumberFormatExce...
Java
["135\n1\n15", "10000\n0\n9"]
1 second
["2", "1"]
NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$.
Java 8
standard input
[ "dp", "hashing", "data structures", "binary search", "strings" ]
0d212ea4fc9f03fdd682289fca9b517e
The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co...
2,600
Print a single integer β€” the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$.
standard output
PASSED
de4eb1221df44583abe17f6ba700c03c
train_000.jsonl
1537454700
Vasya owns three big integers β€” $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.function.IntUnaryOperator; import java.io.IOException; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import java.i...
Java
["135\n1\n15", "10000\n0\n9"]
1 second
["2", "1"]
NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$.
Java 8
standard input
[ "dp", "hashing", "data structures", "binary search", "strings" ]
0d212ea4fc9f03fdd682289fca9b517e
The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co...
2,600
Print a single integer β€” the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$.
standard output
PASSED
9eab162752d37d9d7b4b4bca1ed32086
train_000.jsonl
1537454700
Vasya owns three big integers β€” $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.util.function.IntUnaryOperator; import java.io.IOException; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputSt...
Java
["135\n1\n15", "10000\n0\n9"]
1 second
["2", "1"]
NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$.
Java 8
standard input
[ "dp", "hashing", "data structures", "binary search", "strings" ]
0d212ea4fc9f03fdd682289fca9b517e
The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co...
2,600
Print a single integer β€” the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$.
standard output
PASSED
244f6c3a53b9851765ad41a8114b4eea
train_000.jsonl
1537454700
Vasya owns three big integers β€” $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.stream.IntStream; import java.io.IOException; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.InputSt...
Java
["135\n1\n15", "10000\n0\n9"]
1 second
["2", "1"]
NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$.
Java 8
standard input
[ "dp", "hashing", "data structures", "binary search", "strings" ]
0d212ea4fc9f03fdd682289fca9b517e
The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co...
2,600
Print a single integer β€” the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$.
standard output
PASSED
2dd5b8b3593f03c9f427eb32ec2b7328
train_000.jsonl
1537454700
Vasya owns three big integers β€” $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll...
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
["135\n1\n15", "10000\n0\n9"]
1 second
["2", "1"]
NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$.
Java 8
standard input
[ "dp", "hashing", "data structures", "binary search", "strings" ]
0d212ea4fc9f03fdd682289fca9b517e
The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co...
2,600
Print a single integer β€” the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$.
standard output
PASSED
303d550c499710a550796303d6c469f2
train_000.jsonl
1537454700
Vasya owns three big integers β€” $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static long TIME_START, TIME_END; public static class Task { int mod = 998244353; public class Z { int[] z; public void build(char[] s) { int n = s.length; ...
Java
["135\n1\n15", "10000\n0\n9"]
1 second
["2", "1"]
NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$.
Java 8
standard input
[ "dp", "hashing", "data structures", "binary search", "strings" ]
0d212ea4fc9f03fdd682289fca9b517e
The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co...
2,600
Print a single integer β€” the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$.
standard output
PASSED
441cc566d200d2ac9d911bb3f15ca3d2
train_000.jsonl
1537454700
Vasya owns three big integers β€” $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll...
256 megabytes
//package com.company; import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static long TIME_START, TIME_END; public static class Task { int mod = 998244353; public class Z { int[] z; public void build(char[] s) { int ...
Java
["135\n1\n15", "10000\n0\n9"]
1 second
["2", "1"]
NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$.
Java 8
standard input
[ "dp", "hashing", "data structures", "binary search", "strings" ]
0d212ea4fc9f03fdd682289fca9b517e
The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co...
2,600
Print a single integer β€” the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$.
standard output
PASSED
1f8f0ae618cb99a7d5f46fdf522cde9e
train_000.jsonl
1537454700
Vasya owns three big integers β€” $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static long TIME_START, TIME_END; public static class Task { int mod = 998244353; public class Z { int[] z; public void build(char[] s) { int n = s.length; ...
Java
["135\n1\n15", "10000\n0\n9"]
1 second
["2", "1"]
NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$.
Java 8
standard input
[ "dp", "hashing", "data structures", "binary search", "strings" ]
0d212ea4fc9f03fdd682289fca9b517e
The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co...
2,600
Print a single integer β€” the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$.
standard output
PASSED
35dcc736199f20091e3a1b17d98007b8
train_000.jsonl
1537454700
Vasya owns three big integers β€” $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numCh...
Java
["135\n1\n15", "10000\n0\n9"]
1 second
["2", "1"]
NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$.
Java 8
standard input
[ "dp", "hashing", "data structures", "binary search", "strings" ]
0d212ea4fc9f03fdd682289fca9b517e
The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co...
2,600
Print a single integer β€” the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$.
standard output
PASSED
113cb4425a6807b297a1cf834a95bcfe
train_000.jsonl
1537454700
Vasya owns three big integers β€” $$$a, l, r$$$. Let's define a partition of $$$x$$$ such a sequence of strings $$$s_1, s_2, \dots, s_k$$$ that $$$s_1 + s_2 + \dots + s_k = x$$$, where $$$+$$$ is a concatanation of strings. $$$s_i$$$ is the $$$i$$$-th element of the partition. For example, number $$$12345$$$ has the foll...
256 megabytes
import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.*; import java.io.*; public class Main { private static char [] A,L,R; private static long mod = 998244353; private static long add(long a,long b) { a += b; if (a >= mod) a -= mod; if (a < 0) a += mod; ...
Java
["135\n1\n15", "10000\n0\n9"]
1 second
["2", "1"]
NoteIn the first test case, there are two good partitions $$$13+5$$$ and $$$1+3+5$$$.In the second test case, there is one good partition $$$1+0+0+0+0$$$.
Java 8
standard input
[ "dp", "hashing", "data structures", "binary search", "strings" ]
0d212ea4fc9f03fdd682289fca9b517e
The first line contains a single integer $$$a~(1 \le a \le 10^{1000000})$$$. The second line contains a single integer $$$l~(0 \le l \le 10^{1000000})$$$. The third line contains a single integer $$$r~(0 \le r \le 10^{1000000})$$$. It is guaranteed that $$$l \le r$$$. It is also guaranteed that numbers $$$a, l, r$$$ co...
2,600
Print a single integer β€” the amount of partitions of number $$$a$$$ such that they match all the given requirements modulo $$$998244353$$$.
standard output
PASSED
2273f2faca49d0e694cc9e1f1ce64112
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { public static void main(String[] args){ FastScanner scan = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int n = scan.n...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
d376d3cfa40cef70c20c38dc29e21558
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.lang.Integer.*; public class Main { public static void main(String[] args) throws Exceptio...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
b25fb1c3f6831c66c4670b9ee5aec1f1
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
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.StringTokenizer; public class A { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
4fb1c13927a117d8c74946a76ff9981b
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class SolutionB { public static void main(String[] args) { new SolutionB().run(); } int a[][]; int b[][]; int n; int m; void go(int x){ if(x == n) return; for(int i = 0; i < x; i++){ for(int j = 0; j < m; j++){ b[2 *x - 1 - i][j] = b...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
40c847a2c26543f60e60dcd6ea4a0105
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.util.*; public class Codeforces243B { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), m = in.nextInt(); int[][] ma = new int[n][]; for (int i = 0; i < n; i++) { ma[i] = new int[m]; for (int j =...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
3a604f7a0c3279066cd9cee129f77b80
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.*; import java.util.*; public class CodeForce { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringBuilder sb = new StringBuilder(); public static int checkreverse(int[][] arr,int n) { if(n%2==1) return n; for(int i=n/2-1;i>=0;i--) { for(int j=0;j<a...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
182ddac0ece6588e5932ad31fc9af3a6
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws InterruptedException { InputStream inputStream = System.in; OutputStream outputStream = System.out; MyScanner in = new MyScanner(inputStream); PrintWriter out = new PrintWriter(ou...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
740e831fafd106cb994d5f30530ce3c4
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Don Li */ public class SerejaMirroring { void solve() { int n = in.nextInt(), m = in.nextInt(); int[][] a = new int[n][m]; ...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
853126cb882e2ce8521b0967e7d6a8d2
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.*; import java.util.*; public class CF426B { static boolean equal(int[] aa, int[] bb, int m) { for (int j = 0; j < m; j++) if (aa[j] != bb[j]) return false; return true; } static int solve(int[][] aa, int n, int m) { if (n % 2 == 1) return n; for (int i = 0, j = n - 1; i < j; i++, j...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
f093205dfcfdc55a1b0f8c0f25958441
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.awt.Point; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import javax.security.auth.kerberos.KerberosKey; import javax.tools.JavaFileObject.Kind; import static java.lang.Math.*; public class Main { final boolean ONLINE_JUDGE = System.getProperty("ONL...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
a2df5f49b165beb92381a49685406d69
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * * @author Machis */ public class SerejaandMirroring { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamRe...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
19aa3d5eb0bc5c47ab886b38935bc47a
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.util.Scanner; public class SerejaAndMirroring { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int rows = scan.nextInt(); int columns = scan.nextInt(); if (rows % 2 == 1) { System.out.println(rows); System.exit(0...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
e96a5fac26c15609dc5d0a8dc7cc4141
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class B426 { static int n, m; static int[][] a; public static int minPart(int min, int max){ int part = max-min + 1; int high = max; int low = min; if(part % 2 == 0 && min != max){ while(low <= high){ for(int i=0; i<m;...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
775ac19ebd7a409369c63257655a3da5
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class seeraja_and_mirroring { public static boolean is_a_powerOf2(long n) { return n!=0 && ((n&(n-1)) == 0); } public static void main(String[] args) throws IOException { BufferedReade...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
341f3af5e39adc4b645d25abed97fcf5
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { FastIO io; int check(int[][] a, int n) { if (n % 2 == 1) { return n; } int x = n / 2; for (int i = 0; i < x; i++) { if (!Arrays.equals(a[i], a[n - i - 1])) { ...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
fdc9c8b131c4b9441a86cfc5c2203abf
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
/* Author LAVLESH */ import java.util.*; import java.io.*; import java.math.BigInteger; public class solution { static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st=new StringTokenizer(""); static public String next() { while (st == null || !st.hasMore...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
156af0ec816194fb9b948290205377c9
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
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.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; public class Main { public s...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
fda0844ec1b41c7aab06a05962e873bb
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.math.*; import java.io.*; import java.util.*; public class C426B{ public static void main(String[] args) throws IOException{ Scanner sc=new Scanner(System.in); int N=sc.nextInt(); int S=sc.nextInt(); int[][] ar=new int[N][S]; for(int x=0;x<N;x++) for(int y=0;y<S;y++) ...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
b6cecab71b367dcd53ef8fb36f27c70a
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; p...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
01c57a69a4d627dccc8e07bb98b1ebe5
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author cunbidun */ public class M...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
0a43fea9602803037f53b27285d7cef3
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
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.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public ...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
a7bb3e28fd2bea69efda2c7411c5f6bd
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
c0a06555ec78af6f7e52ae2df5cba340
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class RookBishopKing { private static int n,m; private static int arr[][]; public static int Find(int start, int end){ int size = end-start+1; if (size%2!=0) return size; size/=2; boolean mirror =true; ...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
45126d64aa9f3e1397afa34d9977599f
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.util.Scanner; public class SerejaandMirroring { public static void main(String asd[])throws Exception{ Scanner in=new Scanner(System.in); int n=in.nextInt(); int m=in.nextInt(); int a[][]=new int[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) ...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
4224e8605cf7a9739fe6b809b8cc06e5
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
38e1aa9e9aeb39108ec2d44e83e812ac
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
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.StringTokenizer; public class SerejaAndMirroring { public static void main(String[] args) { PrintWriter pw = new PrintWriter(System.out); reader...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
59e61f91fe17c2e91118d14d578664fe
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.util.*; import java.util.concurrent.ArrayBlockingQueue; import java.io.*; import java.lang.*; public class codeforces { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(System.out); //Code Starts Here int n = in.nextI...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
c25897125b9161f5d8919586df9ad142
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable{ static LinkedList <Integer> adj[]; static int co=0; static void Check2(int n){ adj=new LinkedList[n+1]; for(int i...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output
PASSED
4c3bfac33ab1f6d01c17a85c78dc8e12
train_000.jsonl
1398612600
Let's assume that we are given a matrix b of size x × y, let's determine the operation of mirroring matrix b. The mirroring of matrix b is a 2x × y matrix c which has the following properties: the upper half of matrix c (rows with numbers from 1 to x) exactly matches b; the lower half of matrix c (rows with numbers f...
256 megabytes
import java.util.Scanner; /** * Created by Mehedi on 6/20/2015. */ public class Main { static int ar[][]=new int[102][102],sum[]=new int[102]; static int check(int n,int m){ if((n%2)!=0) return n; for(int i=1;i<=(n/2);i++){ if(sum[i]==sum[n-i+1]){ boolean flag=true;...
Java
["4 3\n0 0 1\n1 1 0\n1 1 0\n0 0 1", "3 3\n0 0 0\n0 0 0\n0 0 0", "8 1\n0\n1\n1\n0\n0\n1\n1\n0"]
1 second
["2", "3", "2"]
NoteIn the first test sample the answer is a 2 × 3 matrix b:001110If we perform a mirroring operation with this matrix, we get the matrix a that is given in the input:001110110001
Java 8
standard input
[ "implementation" ]
90125e9d42c6dcb0bf3b2b5e4d0f845e
The first line contains two integers, n and m (1 ≀ n, m ≀ 100). Each of the next n lines contains m integers β€” the elements of matrix a. The i-th line contains integers ai1, ai2, ..., aim (0 ≀ aij ≀ 1) β€” the i-th row of the matrix a.
1,300
In the single line, print the answer to the problem β€” the minimum number of rows of matrix b.
standard output