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
fd20253b59dfd7e645b048fad0202013
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStream...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
765b93efd87a7369dfba966fef4fa18f
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
//package com.company; import javafx.util.Pair; import java.util.*; public class CF_1393_C { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int T=sc.nextInt(); while(T-->0) { int n=sc.nextInt(); int arr[]=new int[n]; for(int...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
5b2d7e9742e1f9c595f8d8ef243a1cd1
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class C662C { public static void main(Stri...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
7bb1fc04149e77f796f512fc8795c2b6
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.InputStream; import java.util.Scanner; public class C662 { static int countOfDatasets; static int count_of_sweets; static int[] mass; static int[] count; public static void main(String[] args) { readInput(System.in); } private static void readInput(InputStream s) {...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
bcfc8fdec6324742ead7413cd819dac7
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
// package com.company; import java.util.*; import java.lang.*; import java.io.*; //****Use Integer Wrapper Class for Arrays.sort()**** public class EO3 { static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out)); public static void main(String[] Args)throws Exception{ FastReader scan=n...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
320daf1fca4c084747c7220e9c497c91
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
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.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.uti...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
d50ef1d8b722335a8cab1e96d288a680
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*;import java.util.*; import javax.swing.text.rtf.RTFEditorKit; import java.math.*; public class Main { static long mod=1000000007l; static int max=Integer.MAX_VALUE,min=Integer.MIN_VALUE; static long maxl=Long.MAX_VALUE,minl=Long.MIN_VALUE; static BufferedReader br=new BufferedReader(new ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
b73ed658747526159afd8f2ef2e6d90b
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class cf1 { static long mod = (long)1e9 + 7; static long mod1 = 998244353; static FastScanner f; static PrintWriter pw = new PrintWriter(System.out); static Scanner S = new Scanner(System.in); static long x0; static long y...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
096056d3b2defbcf7f4d148faa6a2904
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.Collections; import java.util.*; import java.lang.*; import java.math.BigInteger; import java.io.*; import java.io.*; import java.util.*; import java.util.Arrays; public class CodeChef { public static void main (String[] args) throws IOException { StringBuilder sb=new StringBuilder(); ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
ed882d6164f8ac7e96e441a4c4ccf92f
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class demo_C { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(),n; int a[] = new int[200005]; while( t-- != 0) { n = scan.nextInt(); int ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
ab1b414be30935a9e59324756f83d9a8
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.PrintWriter; import java.util.*; public class Main { static Scanner in; static PrintWriter out; public static void main(String[] args) { in = new Scanner(System.in); out = new PrintWriter(System.out); int t = in.nextInt(); while (t-- > 0) { int n ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
2ea51ded0c0c1e476af770541095c2ed
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.PriorityQueue; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { FastReader sc = new FastReader(); ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
760755a602402d04e6c0240d03718337
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Solution implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private Space...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
e4b80878be7f765fd560f3e7fbe46e6c
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.*; import java.lang.Math; import java.util.*; public class Main { public BufferedReader in; public PrintStream out; public boolean log_enabled = false; public boolean multiply_tests = true; public static boolean do_gen_test = false; public void gen_test() { ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
0bf5dd40b8563578e4bbf85abb9bf73b
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class C1393 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int test = Integer.parseInt(br....
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
d11057911764080e6442373f86bfeea1
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
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\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
0def282e081a7b1a9406a0793b72dba3
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
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 { FastReader sc1 = new FastReader(); Str...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
3ed64e81fce0e4a77034956f9812b6b7
train_000.jsonl
1596810900
Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the...
256 megabytes
//package codeforces.D662; import java.io.IOException; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; /** * @author muhossain * @since 2020-08-08 */ public class C { public static void main(String[] args) { FasterScanner fs = new FasterScanner(); int ...
Java
["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"]
2 seconds
["3\n2\n0\n4"]
NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$...
Java 8
standard input
[ "constructive algorithms", "sortings", "greedy", "math" ]
9d480b3979a7c9789fd8247120f31f03
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$...
1,700
For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag.
standard output
PASSED
95bda585312f6246aee6b5b037303830
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.util.*; import java.io.*; public class TaskC { public static void main(String[] args) { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); boolean[] d = new boolean[n]; for (int i = 0; i < n; i++) { ...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
12a3025196be34267c39c51f226e3e6b
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.Scanner; public class C { static StreamTokenizer st; public static void main(Stri...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
0c5810fcae5dd71834630b43f0f25aef
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; public class C { ...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
2e612938e4c80a1a0f34ccc0e9a1d5ea
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.*; import java.util.*; public class Task1 { public static void main(String[] args) throws IOException { new Task1().solve(); } boolean[] used; int[] a; int n; PrintWriter out; void solve() throws IOException{ Reader in = new Reader(); ...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
b509b85cefa7b27a1ab56514f96c84d7
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { // get input FastScanner in = new FastScanner(System.in); // n int n = in.nextInt(); // set flag to be 0 int flag = 0; // read matrix // every time ...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
f637e74314258dfc97ca61a080aa99cc
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.PrintStream; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.StringToken...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
e2dc85ae1f6b05dfed87eab371191279
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java....
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
75ab19ed701f0c4ed179ec4e2dd15053
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; public class C405E { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); P...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
323cddff78863d9dac7889823396987c
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class Contest405C { public static void solve() throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); // int t = Integer.parseInt(br.readLin...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
c545ddfb838ad4257e659f1e2860b343
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.IOException; import java.util.InputMismatchException; import java.io.PrintStream; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author karan173 */ public class Mai...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
d98e89d11f049619396119b74666e790
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.*; import java.util.*; public class p405c { BufferedReader in; PrintWriter out; StringTokenizer st; String next() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(in.readLine()); } catch (Exception e) { ...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
f24ee1fd238c1e6f746e62b42299f4a9
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.*; import java.util.*; public class cf405c { static FastIO in = new FastIO(), out = in; public static void main(String[] args) { int n = in.nextInt(); int ret = 0; for(int i=0; i<n; i++) for(int j=0; j<n; j++) { if(i == j) ret ^= in.nextInt(); else in.nextInt(); ...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
5fe2e0b8f38217f22944f3a776d4184c
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class C_UnusualProduct { public static void main(String[] args) throws java.io.IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); final int N = Integer.parseInt(input.readLine()); ...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
76190e798f9f59788cc55ec7b5bed058
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.util.*; import java.lang.reflect.Array; import java.math.*; import java.io.*; import java.awt.*; public class Main{ static FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter out = new PrintWriter(System.out); static final int maxn = (int)1e3...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
3412bc7f39e50059ba042f640ed1b6e9
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
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.List; import java.util.StringTokenizer; public class Main { static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writ...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
5673d02beda24d105b08d7529d3d4f04
train_000.jsonl
1395502200
Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. The unusual square of an n × n square matrix A is de...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * Class: Product<br /> * Date: 2014/03/23 00:24<br /> * Description:<br /> * * @author Laiping Zhou(sjtudesigner) */ public class Product { public static void main(String[] args) throws IOException { Bu...
Java
["3\n1 1 1\n0 1 1\n1 0 0\n12\n3\n2 3\n3\n2 2\n2 2\n1 3\n3\n3\n1 2\n2 1\n1 1\n3"]
1 second
["01001"]
null
Java 7
standard input
[ "implementation", "math" ]
332902284154faeaf06d5d05455b7eb6
The first line of input contains an integer n (1 ≤ n ≤ 1000), the number of rows and the number of columns in the matrix A. The next n lines describe the matrix: the i-th line contains n space-separated bits and describes the i-th row of A. The j-th number of the i-th line aij (0 ≤ aij ≤ 1) is the element on the inters...
1,600
Let the number of the 3rd type queries in the input be m. Output a single string s of length m, where the i-th symbol of s is the value of the unusual square of A for the i-th query of the 3rd type as it appears in the input.
standard output
PASSED
775862eefd11fbe05cb7d17d06372d8f
train_000.jsonl
1471698300
Like all children, Alesha loves New Year celebration. During the celebration he and his whole family dress up the fir-tree. Like all children, Alesha likes to play with garlands — chains consisting of a lightbulbs.Alesha uses a grid field sized n × m for playing. The rows of the field are numbered from 1 to n from the ...
256 megabytes
// practice with rainboy import java.io.*; import java.util.*; public class CF707E extends PrintWriter { CF707E() { super(System.out); } static class Scanner { Scanner(InputStream in) { this.in = in; } InputStream in; int k, l; byte[] bb = new byte[1 << 15]; byte getc() { if (k >= l) { k = 0; try { ...
Java
["4 4 3\n5\n1 1 2\n1 2 3\n2 2 1\n2 1 4\n3 1 7\n4\n1 3 1\n2 3 3\n2 4 3\n1 4 1\n7\n4 1 1\n4 2 9\n3 2 8\n3 3 3\n4 3 4\n4 4 1\n3 4 1\n2\nASK 2 2 3 3\nASK 1 1 4 4", "4 4 1\n8\n4 1 1\n3 1 2\n2 1 1\n1 1 7\n1 2 5\n2 2 4\n2 3 1\n1 3 1\n3\nASK 1 1 3 2\nSWITCH 1\nASK 1 1 3 2"]
3 seconds
["15\n52", "19\n0"]
NoteThis image illustrates the first sample case.
Java 11
standard input
[ "data structures" ]
a45f38aae8dadb6f0991b41ecb1be855
The first line of the input contains three integers n, m and k (1 ≤ n, m, k ≤ 2000) — the number of field rows, the number of field columns and the number of garlands placed at the field respectively. Next lines contains garlands set description in the following format: The first line of a single garland description co...
2,400
For each ASK operation print the sum Alesha wants to know in a separate line. Print the answers in chronological order.
standard output
PASSED
ee17bc1684bf69e8a6d845231233c397
train_000.jsonl
1471698300
Like all children, Alesha loves New Year celebration. During the celebration he and his whole family dress up the fir-tree. Like all children, Alesha likes to play with garlands — chains consisting of a lightbulbs.Alesha uses a grid field sized n × m for playing. The rows of the field are numbered from 1 to n from the ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class ft2d { long[][]tree; int max_x;int max_y; ft2d(int x,int y){ tree=new long[x+1][y+1]; max_x=x;max_y=y; } void update(int x , int y , long val){ int y1; while (x <= max_x){ y1 = y; while (y1 <= max_y){ ...
Java
["4 4 3\n5\n1 1 2\n1 2 3\n2 2 1\n2 1 4\n3 1 7\n4\n1 3 1\n2 3 3\n2 4 3\n1 4 1\n7\n4 1 1\n4 2 9\n3 2 8\n3 3 3\n4 3 4\n4 4 1\n3 4 1\n2\nASK 2 2 3 3\nASK 1 1 4 4", "4 4 1\n8\n4 1 1\n3 1 2\n2 1 1\n1 1 7\n1 2 5\n2 2 4\n2 3 1\n1 3 1\n3\nASK 1 1 3 2\nSWITCH 1\nASK 1 1 3 2"]
3 seconds
["15\n52", "19\n0"]
NoteThis image illustrates the first sample case.
Java 11
standard input
[ "data structures" ]
a45f38aae8dadb6f0991b41ecb1be855
The first line of the input contains three integers n, m and k (1 ≤ n, m, k ≤ 2000) — the number of field rows, the number of field columns and the number of garlands placed at the field respectively. Next lines contains garlands set description in the following format: The first line of a single garland description co...
2,400
For each ASK operation print the sum Alesha wants to know in a separate line. Print the answers in chronological order.
standard output
PASSED
004672080e92a4b005204806f08f41cf
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.Reader; import java.util.StringTokenizer; public class TaskB { public static void main(String[] args) throws Exception { Tokenizer in = new Tokenizer(new InputStreamReader(System.in)); int n = in.nextInt(); Point[] p = new P...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
8e0c0f7f9cdba6c863f3809c37c4a73f
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.util.*; import java.io.*; public class B { FastScanner in; PrintWriter out; class Point { long x, y; public Point(long x, long y) { super(); this.x = x; this.y = y; } } Point[] pts; double vecMul(Point p0, Point p1, Point p2) { double x1 = p1.x - p0.x; double x2 = p2.x - p0.x...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
e9a13751ab7ee4aadbadb3ef17d7f460
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.io.*; import java.util.StringTokenizer; /** * Created by gamezovladislav on 21.03.2017. */ public class TaskB { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputRe...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
23cb4290dec456bb0d099b87c567c28a
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
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\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
cbc0f3987c296dbdd5de982fe74fe9e4
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Solution { public static void main(String[] args) throws Exception { MyReader reader = new MyReader(System.in); MyWriter writer = new MyWriter(System.out); new Solution().run(reader, writer); writer.clo...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
0b4773f44834cfec3cd46ea4e53c4c4c
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.io.*; import java.util.*; public class solver { static BufferedReader in; static PrintWriter out; static StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args) throws IOException { String filename = ""; if (filename.isEmpty()) { in = new BufferedReader...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
5fcc2e763a02c6a505b3ec4facfc467f
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.Input...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
530d38a5e2be7c89aa5d8624305fdc16
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.Input...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
772760357afcb73605ba2976262d61aa
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; ...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
e0120bb8048ae258f793bbd7c4b69a6e
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.util.*; import java.io.*; public class B { class Line { double a, b, c; public Line(int x1, int y1, int x2, int y2) { a = y2 - y1; b = x1 - x2; c = -(a * x1 + b * y1); } double dist(int x, int y) { double d = a * x + b * y + c; return Math.abs(d) / Math.sqrt(a * a + b * b); } ...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
8a66475f13832417e4fc6f8cce2a5fd0
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.io.BufferedInputStream; import java.util.concurrent.Callable; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import j...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
a6368ba68ff74a76f69b67fd517bfcee
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.util.*; import java.awt.geom.Line2D; import java.io.*; public class VolatileKite { /************************ SOLUTION STARTS HERE ************************/ static double dot(double[] A, double[] B, double[] C){ double[] AB = new double[2]; double[] BC = new double[2]; ...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
f2c21821e0fcd6168ba540a1b0f87a3b
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.io.*; import java.util.StringTokenizer; /** * Created by gamezovladislav on 21.03.2017. */ public class TaskB { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputRe...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
6e8c3a021c412b45c35d6c5ca344b55e
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.util.*; import java.io.*; public class TaskB { FastScanner in; PrintWriter out; public void solve() throws IOException { int n = in.nextInt(); long[] x = new long[n]; long[] y = new long[n]; for (int i = 0; i < n; i++) { x[i] = in.nextInt(); y[i] = in.nextInt(); } double r = Math.sqrt...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
123602289da5f79177da6b0947a84319
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import javafx.util.Pair; import java.io.*; import java.util.StringTokenizer; /** * @author Aydar Gizatullin a.k.a. lightning95, aydar.gizatullin@gmail.com * Created on 16.04.17. */ public class ProbB { private void solve() { int n = rw.nextInt(); Pair<Integer, Integer>[] a = new Pair[n...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
087ffc4b562ae7d35e2c3f88518f228f
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.Input...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
e91ddb431c8bae0bf8258627186e013b
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.awt.*; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.List; import static java.lang.Math.*; public class B implements Runnable{ // SOLUTION!!! // HACK ME PLEASE IF YOU CAN!!! // PLEASE!!! // PLEASE!!! // PLEASE!!! ...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
7a1997acc04ea7ca8c81809f8637aa75
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.util.Scanner; /** * 772B * Created by happyboy on 2017/6/30. */ public class VilotileKite { public double findMaximumDistance(double[][] points) { double distance=Double.MAX_VALUE; int len=points.length; for(int i=0;i<len;i++) { double ABx=points[(i+...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
0da2aed655134b68c2cdfc2ee3117fc4
train_000.jsonl
1492356900
You are given a convex polygon P with n distinct vertices p1, p2, ..., pn. Vertex pi has coordinates (xi, yi) in the 2D plane. These vertices are listed in clockwise order.You can choose a real number D and move each vertex of the polygon a distance of at most D from their original positions.Find the maximum value of D...
256 megabytes
import java.io.*; import java.util.Locale; import java.util.StringTokenizer; public class A implements Runnable { private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; private BufferedReader in; private PrintWriter out; private StringTokenizer tok = new StringTokeniz...
Java
["4\n0 0\n0 1\n1 1\n1 0", "6\n5 0\n10 0\n12 -4\n10 -8\n5 -8\n3 -4"]
2 seconds
["0.3535533906", "1.0000000000"]
NoteHere is a picture of the first sampleHere is an example of making the polygon non-convex.This is not an optimal solution, since the maximum distance we moved one point is  ≈ 0.4242640687, whereas we can make it non-convex by only moving each point a distance of at most  ≈ 0.3535533906.
Java 8
standard input
[ "geometry" ]
495488223483401ff12ae9c456b4e5fe
The first line has one integer n (4 ≤ n ≤ 1 000) — the number of vertices. The next n lines contain the coordinates of the vertices. Line i contains two integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th vertex. These points are guaranteed to be given in clockwise order, and will form a strictly c...
1,800
Print one real number D, which is the maximum real number such that no matter how you move the vertices, the polygon stays convex. 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 prog...
standard output
PASSED
28f27829159378e2d0ef6e2907a27dff
train_000.jsonl
1349105400
Once upon a time an old man and his wife lived by the great blue sea. One day the old man went fishing and caught a real live gold fish. The fish said: "Oh ye, old fisherman! Pray set me free to the ocean and I will grant you with n gifts, any gifts you wish!". Then the fish gave the old man a list of gifts and their p...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHe...
Java
["3 1\n3 10 20 30", "3 2\n1 40\n4 10 20 30 40"]
2 seconds
["1.000000000", "0.166666667"]
null
Java 6
standard input
[ "dp", "combinatorics", "probabilities", "math" ]
b8b3f75baaef9c4232e7fd7555d4fabb
The first line contains two space-separated integers n and m (1 ≤ n, m ≤ 1000) — the number of the old man's wishes and the number of distinct names in the goldfish's list, correspondingly. Then m lines follow: the i-th line first contains integer ki (ki &gt; 0) — the number of distinct prices of gifts with the i-th na...
2,600
On a single line print one real number — the probability of getting n most valuable gifts. The answer will be considered correct if its absolute or relative error does not exceed 10 - 9.
standard output
PASSED
26eac14712b7ab37a7726316000edfb9
train_000.jsonl
1349105400
Once upon a time an old man and his wife lived by the great blue sea. One day the old man went fishing and caught a real live gold fish. The fish said: "Oh ye, old fisherman! Pray set me free to the ocean and I will grant you with n gifts, any gifts you wish!". Then the fish gave the old man a list of gifts and their p...
256 megabytes
import java.io.*; import java.awt.geom.Point2D; import java.text.*; import java.math.*; import java.util.*; public class Main implements Runnable { final String filename = ""; public void solve() throws Exception { int n = iread(), m = iread(); double[] logNf = new double[1001]; for (int i = 1; i < logNf.le...
Java
["3 1\n3 10 20 30", "3 2\n1 40\n4 10 20 30 40"]
2 seconds
["1.000000000", "0.166666667"]
null
Java 6
standard input
[ "dp", "combinatorics", "probabilities", "math" ]
b8b3f75baaef9c4232e7fd7555d4fabb
The first line contains two space-separated integers n and m (1 ≤ n, m ≤ 1000) — the number of the old man's wishes and the number of distinct names in the goldfish's list, correspondingly. Then m lines follow: the i-th line first contains integer ki (ki &gt; 0) — the number of distinct prices of gifts with the i-th na...
2,600
On a single line print one real number — the probability of getting n most valuable gifts. The answer will be considered correct if its absolute or relative error does not exceed 10 - 9.
standard output
PASSED
2a3868ae204a73743b8b2719348315d5
train_000.jsonl
1349105400
Once upon a time an old man and his wife lived by the great blue sea. One day the old man went fishing and caught a real live gold fish. The fish said: "Oh ye, old fisherman! Pray set me free to the ocean and I will grant you with n gifts, any gifts you wish!". Then the fish gave the old man a list of gifts and their p...
256 megabytes
import java.util.*; public class Main { static int maxn = 1005; static class node implements Comparable<node> { int val, id; node() {} @Override public int compareTo(node a) { if (val == a.val) return a.id - id; return a.val - val; } } public static void main(String[] args) { Scanner cin...
Java
["3 1\n3 10 20 30", "3 2\n1 40\n4 10 20 30 40"]
2 seconds
["1.000000000", "0.166666667"]
null
Java 6
standard input
[ "dp", "combinatorics", "probabilities", "math" ]
b8b3f75baaef9c4232e7fd7555d4fabb
The first line contains two space-separated integers n and m (1 ≤ n, m ≤ 1000) — the number of the old man's wishes and the number of distinct names in the goldfish's list, correspondingly. Then m lines follow: the i-th line first contains integer ki (ki &gt; 0) — the number of distinct prices of gifts with the i-th na...
2,600
On a single line print one real number — the probability of getting n most valuable gifts. The answer will be considered correct if its absolute or relative error does not exceed 10 - 9.
standard output
PASSED
9500393707c889a44b476f010dd3b5f6
train_000.jsonl
1349105400
Once upon a time an old man and his wife lived by the great blue sea. One day the old man went fishing and caught a real live gold fish. The fish said: "Oh ye, old fisherman! Pray set me free to the ocean and I will grant you with n gifts, any gifts you wish!". Then the fish gave the old man a list of gifts and their p...
256 megabytes
//package round142; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; public class E2 { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), m = ni(); int[][] a = new int[m][]; int a...
Java
["3 1\n3 10 20 30", "3 2\n1 40\n4 10 20 30 40"]
2 seconds
["1.000000000", "0.166666667"]
null
Java 6
standard input
[ "dp", "combinatorics", "probabilities", "math" ]
b8b3f75baaef9c4232e7fd7555d4fabb
The first line contains two space-separated integers n and m (1 ≤ n, m ≤ 1000) — the number of the old man's wishes and the number of distinct names in the goldfish's list, correspondingly. Then m lines follow: the i-th line first contains integer ki (ki &gt; 0) — the number of distinct prices of gifts with the i-th na...
2,600
On a single line print one real number — the probability of getting n most valuable gifts. The answer will be considered correct if its absolute or relative error does not exceed 10 - 9.
standard output
PASSED
058cb28a515f02e846e4286e1ab0d2a6
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.io.*; import java.util.*; public class Main{ static int mod = (int)(Math.pow(10, 9) + 7); public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int n =sc.nextInt(); int t = sc.nextInt(); int ...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
42cbe77e35282c0603d5e5fc5b0a8234
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[])throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw=new PrintWriter(System.out); String str[]=br.readLine().split(" "); int n=Inte...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
43cc0cf2c9cf2fd52f5c451af1b24dfb
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { FastReader scan = new FastReader(); //PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("taming.out"))); PrintWriter out = new ...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
a46ba36fe950cb99a30abf27135f42a8
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.sql.Array; import java.sql.SQLOutput; import java.util.*; import java.io.*; import java.math.*; public class MyProgram { public static FastIO file = new FastIO(); private static void solve() { // int tt = nextInt(); int tt = 1; long start = 0; while (tt-- > 0) { ...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
c56de345dfaf7b951c20508cfc8d9ee0
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; public class Main { static final long M = 1000000007; public static void main(String args[]) { ...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
102956e19f199faccb8d83d8a8c8ecc7
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class A { static class Pair{ int idx,s,d; public Pair(int idx,int s,int d){ this.idx=idx; this.s=s; this.d=d; } } static final int oo= Integer.MAX_VALUE; public static void pr...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
070060d592065229f2563dcb4695e9af
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static int MAX = (int)1e5+1; static int ans = Integer.MAX_VALUE; static boolean vis[][]; static int arr[][]; static ArrayList<String> list = new ArrayList<>(); public static void main(String[] args)throws Exception{ //InputReader in...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
6f5920c7e6d2b6d433d702c77494ec67
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.util.*; import java.io.*; /* */ public class Main{ public static OutputStream out=new BufferedOutputStream(System.out); //nl-->neew line; //l-->line; //arp-->array print; //arpnl-->array print new line public static void nl(Object o) throws IOException{out.write((o+"\n").getBytes());} p...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
c4a37390a074ed31c655a23f71857949
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.util.*; public class codeforces{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int t=sc.nextInt(); int max=Integer.MAX_VALUE; int index=0; for(int i=1;i<=n;i++){ int s=sc.nextInt(); int d=sc.nextInt(); while(s<t){ s+=...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
d754bc3725d32d83fd8e133262186988
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.util.*; public class servalAndBus { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int t=sc.nextInt(); int a[]=new int [n]; int b[]=new int [n]; for(int i=0;i<n;i++) { a[i]=sc.nextInt(); b[i]=sc.nextInt(); if(a[i]<t) { while(...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
138fcd2e1bb968c087f1974cbb7ef32f
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
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 * * @author ky112233 */ public class Main { public static void main(String[] args) { InputStream ...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
b909b0dfca275d3748a543e4ebda6346
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n = cin.nextInt(); int t = cin.nextInt(); int[] s = new int[n]; int[] d = new int[n]; int least = 99999999, id = 0; for (int i = 0...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
720f283209544020f90476a07d32fa8f
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.io.*; import java.util.*; public class A { static void solve(FastIO io) { int n = io.nextInt(); int t = io.nextInt(); int min = (int)1e8; int id = -1; for (int i = 0; i < n; i++) { int s = io.nextInt(); int d = io.nextInt(); int w; if (s >= t) w = s - t; else { int...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
86741c0c6bb112e30c9fc68330f6b16b
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.io.*; import java.util.*; public class ProgEc { public static void main(String[] args) throws Exception { //FileInputStream inputStream = new FileInputStream("input.txt"); //FileOutputStream outputStream = new FileOutputStream("output.txt"); InputStream inputStream = System.in; OutputStream ...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
803106979f0aeb0650781859d0c5c992
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class BusRoutes { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); final int buses; final int firstTime; try { S...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
f073bd65eca17d5cc0d1840036933a8a
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; import java.util.Arrays; import java.math.BigInteger; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang....
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
2a3a517b40b41f755bcd9334c9f7ea72
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.io.*; import java.util.*; public class Q3 { public static void main(String[] args) { InputReader in = new InputReader(); int N = in.nextInt(),t=in.nextInt(); int arr[][] = new int[N][2]; int pos=-1; for(int i=0;i<N;i++) { arr[i][0] = in.nextInt();...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
92264f03aec1309ae4f4db5d6397df77
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.util.*; public class ServalAndBus { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int nbuses = scanner.nextInt(); int time = scanner.nextInt(); int min = 999999999; int index = 0; for(int i = 1; i <= nbuses;i++) { // empezamos en uno por que el prime...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
d787d29d03c53f8d94ac51dae5b83fef
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long t = sc.nextLong(); long ans = 1000000000,fans = 0; for(int i=0;i<n;i++){ long s = sc.nextLong(); long d = sc.nextLong(); long temp; ...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
5e6480d13cf2f4234b1ed256fda35fd3
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
740f50484656b5af1d03dbb2cfa5194e
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
/* package whatever; // don't place package name! */ import java.util.Scanner; import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
b5c7f86aee088ec169616fec2580ae5a
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main{ static final FastReader in = new FastReader(); static final FastWriter out = new FastWriter(); public static void main(String[] args) throws IOException{ int n = in.nextInt(); int t = in.nextInt(); int[][...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
e1cfd4637de9d91ffe7ff7696b4e9be9
train_000.jsonl
1555164300
It is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there. The only choice for this poor little boy is to wait for a bus on this rainy day. Under such circumstances, th...
256 megabytes
import java.io.*; import java.util.*; public class A{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n=sc.nextInt(), t=sc.nextInt(); int min=Integer.MAX_VALUE; int route=-1; for(int i=0; i<n; ++i){ int x, y; x=sc.next...
Java
["2 2\n6 4\n9 5", "5 5\n3 3\n2 5\n5 6\n4 9\n6 1", "3 7\n2 2\n2 3\n2 4"]
1 second
["1", "3", "1"]
NoteIn the first example, the first bus of the first route arrives at time $$$6$$$, and the first bus of the second route arrives at time $$$9$$$, so the first route is the answer.In the second example, a bus of the third route arrives at time $$$5$$$, so it is the answer.In the third example, buses of the first route ...
Java 11
standard input
[ "brute force", "math" ]
71be4cccd3b8c494ad7cc2d8a00cf5ed
The first line contains two space-separated integers $$$n$$$ and $$$t$$$ ($$$1\leq n\leq 100$$$, $$$1\leq t\leq 10^5$$$) — the number of bus routes and the time Serval goes to the station. Each of the next $$$n$$$ lines contains two space-separated integers $$$s_i$$$ and $$$d_i$$$ ($$$1\leq s_i,d_i\leq 10^5$$$) — the ...
1,000
Print one number — what bus route Serval will use. If there are several possible answers, you can print any of them.
standard output
PASSED
258be72b8c489f20edf78bbbc222f444
train_000.jsonl
1489851300
A tree is an undirected connected graph without cycles. The distance between two vertices is the number of edges in a simple path between them.Limak is a little polar bear. He lives in a tree that consists of n vertices, numbered 1 through n.Limak recently learned how to jump. He can jump from a vertex to any vertex wi...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf771c { public static void main(String[] args) throws IOException { int n = rni(), k = ni(); long dp[][] = new long[n][k + 1]; Graph g = tree(n); dfs(g, 0, -1, dp,...
Java
["6 2\n1 2\n1 3\n2 4\n2 5\n4 6", "13 3\n1 2\n3 2\n4 2\n5 2\n3 6\n10 6\n6 7\n6 13\n5 8\n5 9\n9 11\n11 12", "3 5\n2 1\n3 1"]
2 seconds
["20", "114", "3"]
NoteIn the first sample, the given tree has 6 vertices and it's displayed on the drawing below. Limak can jump to any vertex within distance at most 2. For example, from the vertex 5 he can jump to any of vertices: 1, 2 and 4 (well, he can also jump to the vertex 5 itself). There are pairs of vertices (s, t) such tha...
Java 11
standard input
[ "dp", "dfs and similar", "trees" ]
0b4362204bb9f0e95eaf7e2949315c8f
The first line of the input contains two integers n and k (2 ≤ n ≤ 200 000, 1 ≤ k ≤ 5) — the number of vertices in the tree and the maximum allowed jump distance respectively. The next n - 1 lines describe edges in the tree. The i-th of those lines contains two integers ai and bi (1 ≤ ai, bi ≤ n) — the indices on verti...
2,100
Print one integer, denoting the sum of f(s, t) over all pairs of vertices (s, t) such that s &lt; t.
standard output
PASSED
bd80891160f64ec7372f6171ae0b7bc7
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
//===========================================================================// // Author: Zakhar_Voit // Module: main // Description: // Creation date: 08.03.2012 17:33:29 // Remarks: //===========================================================================// import java.io.*; import java.util.*; import static ...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
de874605547e6ee525f27b011dc4f441
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; ...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
2272626ab8bc21205e1ac896e68f3143
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Scanner; public class MessageProblem { public static BufferedReader openR...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
4230077e68731e236d34a75fc7ba593d
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.util.*; import java.io.*; public class Main{ BufferedReader in; StringTokenizer str = null; PrintWriter out; private String next() throws Exception{ while (str == null || !str.hasMoreElements()) str = new StringTokenizer(in.readLine()); return str.nextToken(); } ...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
1183e41e10ad8708192e088f28c08ae2
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.LinkedList; import java.util.List; /** * Author: Vasiliy Homutov - vasiliy.homutov@gmail.com * Date: 02.05.12 * See: ht...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
5bc909c45857fc896d904d10137bb69f
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.io.*; import java.util.LinkedList; import java.util.List; /** * Author: Vasiliy Homutov - vasiliy.homutov@gmail.com * Date: 02.05.12 * See: http://codeforces.ru/problemset/problem/157/C */ public class Message { public static class MessageHelper { private static String iterateChar(char ...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
d0e91bcdee24cbace4aa59a877a80280
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.awt.Point; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelper plug-in Actual solution is a...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
4e4bc7fcd68b52a92a9893853baec53f
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.util.*; public class C { public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s = sc.nextLine(); String u = sc.nextLine(); int sLen = s.length(); int uLen = u.length(); int minChanges = uLen; for (int i = -uLen; i < sLen; i++){ int neededChanges = 0; for (...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
64958efddf115f24d9bea35aa4f24ab7
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.util.Arrays; import java.util.Scanner; /** * Alexandra Mikhaylova mikhaylova@yandex-team.ru */ public class E { private final static int MAX_MSG_SIZE = 2000; private static String BAD_SYMBOLS = getBadSymbols(); private static String getBadSymbols() { char[] badSymbols = new char[MAX_...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
9d1959cb114a9e803e08f3dff7371482
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class C { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.o...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
4bc71d412967398edd657a8d649e43e4
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Message { public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out ...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
d6903db93442a0810a3538c1e3208138
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Message { public static void main(String args[]) throws IOException { BufferedReader br; br = new BufferedReader(new InputStreamReader(System.in)); StringBuffer read = new StringBu...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
6c4f8c9cd5911402328b7c91514b7152
train_000.jsonl
1330536600
Dr. Moriarty is about to send a message to Sherlock Holmes. He has a string s. String p is called a substring of string s if you can read it starting from some position in the string s. For example, string "aba" has six substrings: "a", "b", "a", "ab", "ba", "aba".Dr. Moriarty plans to take string s and cut out some su...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class Main{ public static void go(Scanner in, PrintWriter out) { String s = in.nextLine(); String u = in.nextLine(); int ans = u.length(); for (int start = -u.length()+1; start < s.length(); start++) { // sta...
Java
["aaaaa\naaa", "abcabc\nbcd", "abcdef\nklmnopq"]
2 seconds
["0", "1", "7"]
NoteIn the first sample Moriarty can take any substring of length 3, and it will be equal to the required message u, so Moriarty won't have to make any changes.In the second sample you should take a substring consisting of characters from second to fourth ("bca") or from fifth to sixth ("bc"). Then you will only have t...
Java 7
standard input
[ "dp", "brute force", "strings" ]
430486b13b2f3be12cf47fac105056ae
The first line contains a non-empty string s, consisting of lowercase Latin letters. The second line contains a non-empty string u, consisting of lowercase Latin letters. The lengths of both strings are in the range from 1 to 2000, inclusive.
1,700
Print the only integer — the minimum number of changes that Dr. Moriarty has to make with the string that you choose.
standard output
PASSED
97a0ba757dca204565c7d12d9c35c60e
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { public static boolean f(ArrayList<ArrayList<Integer>> tree, long[] h, long[] good, long[] bad, long[] sums, int v, boolean[] used) { if (used[v]) return true; used[v] = true; boolean resu...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
f305ce6295debb9795002c46ecc70c5c
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
//package Codeforces.Round660Div2.C_UncleBogdanAndCountryHappiness; import java.util.*; public class C_UncleBogdanAndCountryHappiness { static class City { int id; long pop; long hi; long happy; long unhappy; long totalpop; boolean isVisited; Cit...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
9ff87a18dea725290cdccfabf37813f9
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.Collectors; public class Main { class Node{ int pass; int p; int h; int i; Set<Node> ch; } void remParr(Node node, Node par){ node.ch.remove(par); for (Node ch : node.ch) { re...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output
PASSED
4717dbffefb4ac03257d3518e539ca55
train_000.jsonl
1596119700
Uncle Bogdan is in captain Flint's crew for a long time and sometimes gets nostalgic for his homeland. Today he told you how his country introduced a happiness index.There are $$$n$$$ cities and $$$n−1$$$ undirected roads connecting pairs of cities. Citizens of any city can reach any other city traveling by these roads...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.Collectors; public class Main { private int[] p; private int[] h; private List<List<Integer>> graph; static class Node { int h; int p; int w; int g; List<Node> children; } Node build(int u, ...
Java
["2\n7 4\n1 0 1 1 0 1 0\n4 0 0 -1 0 -1 0\n1 2\n1 3\n1 4\n3 5\n3 6\n3 7\n5 11\n1 2 5 2 1\n-11 -2 -6 -2 -1\n1 2\n1 3\n1 4\n3 5", "2\n4 4\n1 1 1 1\n4 1 -3 -1\n1 2\n1 3\n1 4\n3 13\n3 3 7\n13 1 4\n1 2\n1 3"]
2 seconds
["YES\nYES", "NO\nNO"]
NoteLet's look at the first test case of the first sample: At first, all citizens are in the capital. Let's describe one of possible scenarios: a person from city $$$1$$$: he lives in the capital and is in good mood; a person from city $$$4$$$: he visited cities $$$1$$$ and $$$4$$$, his mood was ruined between cit...
Java 11
standard input
[ "greedy", "dfs and similar", "trees", "math" ]
0369c070f4ac9aba4887bae32ad8b85b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10000$$$) — the number of test cases. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 10^5$$$; $$$0 \le m \le 10^9$$$) — the number of cities and citizens. The second line of each test case contains $$$n$$$ integ...
1,800
For each test case, print YES, if the collected data is correct, or NO — otherwise. You can print characters in YES or NO in any case.
standard output