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
70619bc0be9791155759395303ecfcdb
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.*; public class CF_1354_C1 { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int T=sc.nextInt(); while(T-->0) { int n=sc.nextInt(); n=n*2; int ts=(2*n-4)*90; double ang=ts*1.0/n; int p=n...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
6d3948cb8381169142430bfe8023d593
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.util.*; public class Main { public static void main(String[] args) throws FileNotFoundException { FastReader fr = new FastReader(); int tc = fr.nextInt(); BigDecimal err = new BigDecimal("0.41421356237309510"); while (tc-- > 0) { int ...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
f82392d8931fd2793a4476d0de74c85b
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import sun.awt.image.IntegerComponentRaster; import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.util.*; /** * Built using CHelper plug-in * Actual solution is at ...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
1798bc2b156515d2af202e0668394eec
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ static PrintWriter out=new PrintWriter(System.out); public static void main (String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String[] input=br.readLine().trim().split(" "); int numTestC...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
a8dc18815e9bdf14ef3a29218c68d668
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ static PrintWriter out=new PrintWriter(System.out); public static void main (String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String[] input=br.readLine().trim().split(" "); int numTestC...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
e42c54b59afdb307e69b8da9524e925f
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
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.Comparator; import java.util.Objects; import java.util.StringTokenizer; import java.util.function.BiFunction; import java.uti...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
d0a944d85c75fa35eb441f52446fef59
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
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 { BufferedReader br=new BufferedReader(new ...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
fd0f2e9d979e114b6278757e29d0e45e
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { private static FastReader fastReader = new FastReader(); public static void main(String[] args) { Task solver = new Task(); solver.solve(); } static class Task { private static StringBuilder result = new StringBuilder(); ...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
f9b5fbe2d58baabf4c65547ddd1a8a0e
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { private static FastReader fastReader = new FastReader(); public static void main(String[] args) { Task solver = new Task(); solver.solve(); } static class Task { private static StringBuilder result = new StringBuilder(); ...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
fa1922f777e1eb704c6b82a635b61e01
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int t = Integer.pa...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
9a171de7249de649eedefdebbb56c2cb
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String args[]) throws IOException { InOut inout = new InOut(); Resolver resolver = new Resolver(inout); resolver.solve(); inout.flush(); } private static class Resolver { final l...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
571b0b33a9f8e0e3f008eded0ca3713b
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.*; import java.io.*; public class CF1354C1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int i = 0; i < t; i++) System.out.println(1 / Math.tan(Math.PI / (2 * in.nextInt()))); } }
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
fcd121e9f0e1947bfa7eef02767eb330
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.io.*; import java.util.*; /** * User :- sudhakar * Date :- 19/05/20 * Time :- 1:25 PM */ public class SimplePolygonEmbedding { static final int MOD = 1000000007; /*Inner class for fast input*/ static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInput...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
4e1b02bb98169d8cb4a68467be2d782d
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
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
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
049dd699d7219f5296ee17c78d8cdbea
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
c3b0b9f36e88a8b23d8cc54402becb0c
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.math.BigInteger; import java.util.Scanner; import java.util.StringTokenizer; import java.util.TreeMap; public class temp { v...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
d49e75ce27198cde19a8d59069dd480c
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Polygon { int n; public Polygon(int n) { this.n = n; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); for (int i = 0; i < N; i++) { in...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
444fd1c7250a58060d24721f4e9bff9a
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Solution{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } S...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
f701004988112f8dae917cdb9cf36f40
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; public class C { public static class pair implements Comparable<pair> { int id; int ans; pair(int x, int y) { id = x; ans = y; } public pair() { } public int compareTo(pair o) { // TODO Auto-generated metho...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
d5e397671389a81a0c13a11919429a24
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Scanner; public class C1354 { public static void main(String[] args) throws IOException{ Scanner scanner = new Scanner(System.in); int cases = scanner.nextInt(); BufferedWriter log = new BufferedWriter...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
e5123a3e337f1eb544da1fc14d6f6306
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
/* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⡎...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
eaa843dc3e57282209d5bfa4ccc7f0df
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
/* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⡎...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
8baa83df3434c6d1e018dbc107a0109c
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.Locale; import java.util.Scanner; public class C1354 { public static void main(String[] args) { Locale.setDefault(Locale.US); Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t=0; t<T; t++) { int n = in.nextInt(); int side...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
be0294b6d8e3f01880e177e4d28955d6
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.Locale; import java.util.Scanner; public class C1354 { public static void main(String[] args) { Locale.setDefault(Locale.US); Scanner in = new Scanner(System.in); int T = in.nextInt(); for (int t=0; t<T; t++) { int n = in.nextInt(); int side...
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
b2a04bda136946304c6cea15902989a5
train_001.jsonl
1589707200
The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $$$n$$$ is always even, and in C2, $$$n$$$ is always odd.You are given a regular polygon with $$$2 \cdot n$$$ vertices (it's convex and has equal sides and equal angles) and all its sides have length $$...
256 megabytes
import java.util.*; import java.io.*; public class Main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int tc=sc.nextInt(); while(tc-->0){ int n=sc.nextInt(); double d=1.0/Math.tan(Math.PI/(2.0*n)); System.out.printf("%.9f",d); System.out.println(); } } }
Java
["3\n2\n4\n200"]
2 seconds
["1.000000000\n2.414213562\n127.321336469"]
null
Java 8
standard input
[ "binary search", "geometry", "ternary search", "math" ]
0c7a476716445c535a61f4e81edc7f75
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 200$$$) — the number of test cases. Next $$$T$$$ lines contain descriptions of test cases — one per line. Each line contains single even integer $$$n$$$ ($$$2 \le n \le 200$$$). Don't forget you need to embed $$$2n$$$-gon, not an $$$n$$$-gon.
1,400
Print $$$T$$$ real numbers — one per test case. For each test case, print the minimum length of a side of the square $$$2n$$$-gon can be embedded in. Your answer will be considered correct if its absolute or relative error doesn't exceed $$$10^{-6}$$$.
standard output
PASSED
ab06199d35005de44eb3914c57fb1f26
train_001.jsonl
1492356900
You have n devices that you want to use simultaneously.The i-th device uses ai units of power per second. This usage is continuous. That is, in λ seconds, the device will use λ·ai units of power. The i-th device currently has bi units of power stored. All devices can store an arbitrary amount of power.You have a single...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; public class C801{ void solve() { int n = ni(), p = ni(); int[] a = new int[n]; int[] b = new int[n]; for(int i=0;i<n;i++) { a[i] = ni(); b[i] = ni(); } long sum = ...
Java
["2 1\n2 2\n2 1000", "1 100\n1 1", "3 5\n4 3\n5 2\n6 1"]
2 seconds
["2.0000000000", "-1", "0.5000000000"]
NoteIn sample test 1, you can charge the first device for the entire time until it hits zero power. The second device has enough power to last this time without being charged.In sample test 2, you can use the device indefinitely.In sample test 3, we can charge the third device for 2 / 5 of a second, then switch to char...
Java 8
standard input
[ "binary search", "greedy" ]
1c2fc9449989d14d9eb02a390f36b7a6
The first line contains two integers, n and p (1 ≤ n ≤ 100 000, 1 ≤ p ≤ 109) — the number of devices and the power of the charger. This is followed by n lines which contain two integers each. Line i contains the integers ai and bi (1 ≤ ai, bi ≤ 100 000) — the power of the device and the amount of power stored in the de...
1,800
If you can use the devices indefinitely, print -1. Otherwise, print the maximum amount of time before any one device hits 0 power. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 4. Namely, let's assume that your answer is a and the answer of the jury is b. The checker prog...
standard output
PASSED
777ac960e1d3d645300cbf926ea54124
train_001.jsonl
1492356900
You have n devices that you want to use simultaneously.The i-th device uses ai units of power per second. This usage is continuous. That is, in λ seconds, the device will use λ·ai units of power. The i-th device currently has bi units of power stored. All devices can store an arbitrary amount of power.You have a single...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.stream.IntStream; import java.io.OutputStream; import java.util.Arrays; import java.util.stream.LongStream; import java.io.IOException; import java.util.stream.DoubleStream; import java.io.UncheckedIOException; import ...
Java
["2 1\n2 2\n2 1000", "1 100\n1 1", "3 5\n4 3\n5 2\n6 1"]
2 seconds
["2.0000000000", "-1", "0.5000000000"]
NoteIn sample test 1, you can charge the first device for the entire time until it hits zero power. The second device has enough power to last this time without being charged.In sample test 2, you can use the device indefinitely.In sample test 3, we can charge the third device for 2 / 5 of a second, then switch to char...
Java 8
standard input
[ "binary search", "greedy" ]
1c2fc9449989d14d9eb02a390f36b7a6
The first line contains two integers, n and p (1 ≤ n ≤ 100 000, 1 ≤ p ≤ 109) — the number of devices and the power of the charger. This is followed by n lines which contain two integers each. Line i contains the integers ai and bi (1 ≤ ai, bi ≤ 100 000) — the power of the device and the amount of power stored in the de...
1,800
If you can use the devices indefinitely, print -1. Otherwise, print the maximum amount of time before any one device hits 0 power. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 4. Namely, let's assume that your answer is a and the answer of the jury is b. The checker prog...
standard output
PASSED
d05c37129e74d35aade39bab47d62afd
train_001.jsonl
1492356900
You have n devices that you want to use simultaneously.The i-th device uses ai units of power per second. This usage is continuous. That is, in λ seconds, the device will use λ·ai units of power. The i-th device currently has bi units of power stored. All devices can store an arbitrary amount of power.You have a single...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.stream.IntStream; import java.io.OutputStream; import java.util.Arrays; import java.util.stream.LongStream; import java.io.IOException; import java.io.UncheckedIOException; import java.math.BigDecimal; import java.io.C...
Java
["2 1\n2 2\n2 1000", "1 100\n1 1", "3 5\n4 3\n5 2\n6 1"]
2 seconds
["2.0000000000", "-1", "0.5000000000"]
NoteIn sample test 1, you can charge the first device for the entire time until it hits zero power. The second device has enough power to last this time without being charged.In sample test 2, you can use the device indefinitely.In sample test 3, we can charge the third device for 2 / 5 of a second, then switch to char...
Java 8
standard input
[ "binary search", "greedy" ]
1c2fc9449989d14d9eb02a390f36b7a6
The first line contains two integers, n and p (1 ≤ n ≤ 100 000, 1 ≤ p ≤ 109) — the number of devices and the power of the charger. This is followed by n lines which contain two integers each. Line i contains the integers ai and bi (1 ≤ ai, bi ≤ 100 000) — the power of the device and the amount of power stored in the de...
1,800
If you can use the devices indefinitely, print -1. Otherwise, print the maximum amount of time before any one device hits 0 power. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 4. Namely, let's assume that your answer is a and the answer of the jury is b. The checker prog...
standard output
PASSED
eb86f11196020e5049c8c8ded47ab227
train_001.jsonl
1492356900
You have n devices that you want to use simultaneously.The i-th device uses ai units of power per second. This usage is continuous. That is, in λ seconds, the device will use λ·ai units of power. The i-th device currently has bi units of power stored. All devices can store an arbitrary amount of power.You have a single...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.util.stream.LongStream; import java.io.IOException; import java.io.UncheckedIOException; import java.math.BigDecimal; import java.util.stream.Stream; import java.io.Clos...
Java
["2 1\n2 2\n2 1000", "1 100\n1 1", "3 5\n4 3\n5 2\n6 1"]
2 seconds
["2.0000000000", "-1", "0.5000000000"]
NoteIn sample test 1, you can charge the first device for the entire time until it hits zero power. The second device has enough power to last this time without being charged.In sample test 2, you can use the device indefinitely.In sample test 3, we can charge the third device for 2 / 5 of a second, then switch to char...
Java 8
standard input
[ "binary search", "greedy" ]
1c2fc9449989d14d9eb02a390f36b7a6
The first line contains two integers, n and p (1 ≤ n ≤ 100 000, 1 ≤ p ≤ 109) — the number of devices and the power of the charger. This is followed by n lines which contain two integers each. Line i contains the integers ai and bi (1 ≤ ai, bi ≤ 100 000) — the power of the device and the amount of power stored in the de...
1,800
If you can use the devices indefinitely, print -1. Otherwise, print the maximum amount of time before any one device hits 0 power. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 4. Namely, let's assume that your answer is a and the answer of the jury is b. The checker prog...
standard output
PASSED
d4ca1eb8f578374d5f6155a06c7d3223
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
931513469da7311377bb03eb3e320b9f
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.util.*; public class problem967A { private static Scanner in = new Scanner(System.in); private static int n = 0, s = 0; private static ArrayList<Time> schedule = new ArrayList<Time>(); public static void main(String[] args) { n = in.nextInt(); s = in.nextInt(); for (int i = 0; i < n; i++) { Time...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
8647a6a2dcd4f1cd02a56ce81ac00ce7
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.util.*; public class ContestA { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int diff = m+1; int a = 0; for(int i=0;i<n;i++){ int s = in.nextInt()*60+in.nextInt(); ...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
592284735b0145aa0f177242739c0a17
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class JavaApplication6 { public static void main(String[] args) throws IOException { in.init(System.in); ...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
f7f877c8d4c1bd6bfa27fe5a36f6ac57
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class MainClass { public static void main(String[] args) throws IOException { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); int n=in.nextInt(); int s=in.nextInt(); int oh=0,om=0; boolean...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
39b4fc1a5e1d43ee0bdaa9344f990621
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
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 Jeong Juhyeon */ public class Main { public static void main(String[] args) { InputSt...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
a43f5297becd119c5a86aa3d2fc63e97
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; /** * * @author Simone Vuotto */ public class A { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int s = sc...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
65dd9878d908a86031a524890b286ff3
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.util.Scanner; public class Solution1 { int N; int S; public static void main(String[] args) { Scanner sc = new Scanner(System.in); Solution1 tr = new Solution1(); tr.test(sc); sc.close(); } void test(Scanner sc){ N = sc.nextInt(); S = sc.nextInt(); int input[] = new int[N]; for (int i...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
1b1d4425038ec7e04ee426fe33e73684
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int s = sc.nextInt(); int time=0; int ans=-1; for(int i=0;i<n;i++) { int h = sc.nextInt(); int m = sc.nextInt(); int value = h*60 + m; if(i==...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
bb081a158d69913d2ec4170c9ebaa3b5
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.io.*; import java.util.*; public class MindTheGap { public static void main (String[] args) throws Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(); int s = in.nextInt(); int[] time = new int[n]; for (int i = 0; i < n; i++) { in...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
65aa8a226533a2a1dbb2d5996d63adb1
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.io.*; public class CFR477A { static int n, s, h[] = new int[101], m[] = new int[101], t[] = new int[101], ans = -1; static String ins[]; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Buffered...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
95039ba40e22003487abb23af6924750
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.text.DecimalFormat; import java.io.*; import java.util.*; import java.math.*; public class Main{ static InputReader in=new InputReader(System.in); static Scanner inn = new Scanner(System.in); static PrintWriter out=new PrintWriter(System.out); static int m=0,n=0; static int[] hour=new int[110];...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
2ee6f83a24c52e5999fbbaf2945c5d07
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.util.*; public class A967_MindTheGap { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(); int s = sc.nextInt(); int[] arr = new int[n]; for (int i=0; i<n; i++) { int hour = sc.nextInt(); int min = sc.nextInt(); arr[i] = hour*60+min;...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
7bdea1315cdbe8b0b5be2300fec5d8f5
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.PriorityQueue; import java.util.StringTokenizer; public class B{ public static void main(String args[]) throws IOException {...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
4dfd6dd7212b70affb458be17a2b466a
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class test{ public static void main(String[] args) throws IOException{ //Scanner in = new Scanner(System.in); BufferedReader br = new BufferedReader(new...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
f01ee1fa5b4207dbe5e59af9b479e8ca
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.util.*; public class Main{ static Scanner sc = new Scanner(System.in); public static void main(String[] args){ int n = sc.nextInt(), s = sc.nextInt(); int arr[] = new int[n+2]; arr[0] = -s-1; for(int i = 1; i<=n; i++){ arr[i] = sc.nextInt()*60+sc.nextInt(); } arr[n+1] = 100000; for(int ...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
75846280ded04509e88957a1865ee6fd
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.util.*; import java.io.*; // Main public class Main { public static void main (String[] argv) { new Main(); } boolean test = false; public Main() { FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in))); //FastReader in = new FastReader(new Buffere...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
04f6be61a55291da0864b33629d9b72b
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.io.*; import java.util.*; public class div477A { BufferedReader in; PrintWriter ob; StringTokenizer st; public static void main(String[] args) throws IOException { new div477A().run(); } void run() throws IOException { //in=new BufferedReader(new FileReader("input.txt")); in=new BufferedReader(n...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
570d78bd8d454e209133a0e989f83b0f
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; /** * MindGap * create by chenshihang on 2018/5/26 */ public class Main { public static void main(String[] args) throws IOException { StreamTokenizer in = new StreamTokenizer(ne...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
bb11dcbd2400857f0c021fd9efa6ee56
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.util.Scanner; public class Main{ public static void main(String []args){ int n,m; Scanner sc = new Scanner(System.in); while(sc.hasNext()){ n = sc.nextInt(); m = sc.nextInt(); int [] a = new int[1001]; int [] b = new int[1001]; ...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
ac74ad1c8c7d0a45454d55188ef75709
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import java.io.*; import java.util.*; import javax.swing.plaf.synth.SynthSeparatorUI; public class Main { private static Scanner in=new Scanner(new BufferedInputStream(System.in)); public static void main(String[] args) { // TODO Auto-generated method stub int n=in.nextInt(),s=in.nextInt()+1; int t; int k=in...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
12a72aebd74345e074d339449bdb5237
train_001.jsonl
1525007700
These days Arkady works as an air traffic controller at a large airport. He controls a runway which is usually used for landings only. Thus, he has a schedule of planes that are landing in the nearest future, each landing lasts $$$1$$$ minute.He was asked to insert one takeoff in the schedule. The takeoff takes $$$1$$$...
256 megabytes
import javax.jws.soap.SOAPBinding; import java.util.Scanner; public class A_MindTheGap { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int s = scanner.nextInt(); int[] landings = new int[n+1]; // int last; ...
Java
["6 60\n0 0\n1 20\n3 21\n5 0\n19 30\n23 40", "16 50\n0 30\n1 20\n3 0\n4 30\n6 10\n7 50\n9 30\n11 10\n12 50\n14 30\n16 10\n17 50\n19 30\n21 10\n22 50\n23 59", "3 17\n0 30\n1 0\n12 0"]
1 second
["6 1", "24 50", "0 0"]
NoteIn the first example note that there is not enough time between 1:20 and 3:21, because each landing and the takeoff take one minute.In the second example there is no gaps in the schedule, so Arkady can only add takeoff after all landings. Note that it is possible that one should wait more than $$$24$$$ hours to ins...
Java 8
standard input
[ "implementation" ]
dcca7c58ba7111125608f659a577c3a2
The first line of input contains two integers $$$n$$$ and $$$s$$$ ($$$1 \le n \le 100$$$, $$$1 \le s \le 60$$$) — the number of landings on the schedule and the minimum allowed time (in minutes) between a landing and a takeoff. Each of next $$$n$$$ lines contains two integers $$$h$$$ and $$$m$$$ ($$$0 \le h \le 23$$$, ...
1,100
Print two integers $$$h$$$ and $$$m$$$ — the hour and the minute from the current moment of the earliest time Arkady can insert the takeoff.
standard output
PASSED
acc0e1d36e67216639a0dd194cd6a591
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.io.*; import java.util.*; public class C1111 { static long a,b; static int k,arr[]; static long find(int lo,int hi,int left,int right) { int num=right-left+1; if(num==0) return a; if(lo==hi) return b*num; int mid=(lo+hi)/2; int...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
e4cbe747adda0001780d612d9969c582
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.io.*; import java.util.*; public class C1111 { static long a,b; static int k,arr[]; static long find(int lo,int hi,int left,int right) { int num=right-left+1; if(num==0) return a; if(lo==hi) return b*num; int mid=(lo+hi)/2; int...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
9dae28481fef8314dd0b488b534ee52c
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.io.IOException; import java.util.HashMap; import java.util.NoSuchElementException; public class Main{ static HashMap<Long,Integer>[] map; static int n; static int k; static int A; static int B; static long[] pow; @SuppressWarnings("unchecked") public static void main(String args[])throws Exception{...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
59d5c313e8485177099d7f0ca92d408c
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.io.*; import java.util.*; public class C1111 { static int n,k,A,B; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] ss = br.readLine().trim().split("\\s+"); n = Integer.parseInt(ss[...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
40562be177aba0c43c0bb1c4786b99ff
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); void run(){ out.println(work()); out.flush(); } Integer[] count; long A,B; int n,k; long work() ...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
e244b1cbef2be85ba46e41d101a4a2a7
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Solver { private static int[] p; private static long a; private static long b; private static int k; public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); k = s.nex...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
b80efb134877d19ca861611fd5097824
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(System.out); //Scanner sc = new Scanner(); Reader in = new Reader(); Main solver = new Main(); solver....
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
f500d92907970c602292b6c6e2bfef11
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; public class Solution { static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; public Input...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
882dd85013d27d3fb4004009c535eb01
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.TreeMap; import java.util.StringTokenizer; import java.util.Map; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /**...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
3b6fba6e3b419242e685018627fb901b
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.lang.*; import java.math.*; import java.util.*; import java.io.*; public class Main { void solve() { n=ni(); k=ni(); A=ni(); B=ni(); a=new int[k+1]; for(int i=1;i<=k;i++) a[i]=ni(); Arrays.sort(a,1,k+1); long ans=go(1,1<<n); pw.println(ans); } l...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
c622cac5070952efd082624311f68af4
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class CreativeSnap { static Long[] dp; static int INF = (int) 1e9 + 7; public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(), k = s.nextInt(), A = s.nextInt(), B = s.nextInt(); dp =...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
b0c49e2aacb49df870091072c8bb8534
train_001.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
// package CF1111; import java.io.*; import java.util.*; public class CF1111C { static FastReader s; static PrintWriter out; static String INPUT = "3 2 5 1\n" + "8 7\n"; //02357 public static void main(String[] args) { long time = System.currentTimeMillis(); boolean oj = Sy...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
ff51466dc428973be4d3349687dfdc8b
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; public class Forca390B { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for (int i = 0; i < n; i++) { a[i] = in...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
56f8e5b590688ab33265fcd2746951de
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int[] v = new int[n]; for(int i=0; i<n; i++) a[i] = sc.nextInt()*2; for(int i=0; i<n; i++) v[i] = sc.nextInt(); long ans = 0, x, y; // S...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
27a7ffed840cf971c1a7a3aa5e960538
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner s = new Scanner(System.in); int size = s.nextInt(); int[] a = new int[size]; long count = 0; for(int i = 0 ; i < size; i++ ) { a[i] = s.nextInt(); } ...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
04a804de318827dad26823ce56b49d13
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner in=new Scanner(System.in); int n=in.nextInt(); long count=0; int A[]=new int[n]; int B[]=new int[n]; for(int i=0;i<n;i++){ A[i]=in.nextInt(); } for(...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
f084a5bf2220e22c7afd9204879810ab
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); long result = 0; int[] a = new int[n]; for(int i = 0; i < n; i++) { a[i] = scanner.nextInt(); } long[] b = new long[n]; for(int i = 0; i < n; i++...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
98775061d0a83f4ec536381516e03e8a
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; public class B390{ static final boolean FILE_IO = false; static final String output_file = "outp...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
57eafa3a7a28a800ed3d6c175432f348
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { Input...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
4945beda78df5e1081e78f633a0a8cb0
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.util.*; public class B { public static void main(String[] args) { Scanner qwe = new Scanner(System.in); int n = qwe.nextInt(); long[] a= new long[n]; for (int i = 0; i < a.length; i++) { a[i] = qwe.nextLong(); } long[] b = new long[n]; long ans = 0; for (int i = 0; i < b.leng...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
6cc6c4d364d1d558080b1bb331e93708
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; import java.io.InputStream; /** *...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
9acef720521dfc4f89fea0d46a86c8c0
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); long arr[] = new long [n]; long arr1[] = new long [n]; for (int i=0; i<n;i++){ arr[i] = scanner.nextLong()...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
6e6b1300bcda874f23e982d80acbc9b0
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.io.*; import java.util.*; public class b { public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(); int[] as = new int[n], bs = new int[n]; for(int i = 0; i<n; i++) as[i] = input.nextInt(); for(int i = 0;...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
8bc7ba937b3c7319571232c2694acfe7
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.util.*; public class CF229{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); Long[] a=new Long[n]; Long[] b=new Long[n]; for(int i=0;i<n;i++){ a[i]=sc.nextLong(); } for(int i=0;i<n;i++){ b[i]=sc.nextLong(); } long total=0; for(int...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
c7a4eb0f0801b654bc40aac4c3ee587c
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); ...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
fde2895eec3ec1f33c51c1d9e596ffbb
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) throws IOException { in.init(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); long ans = 0; long[] a = new long[n]; long[] b = new long[n]; for(int i = 0; i < n; i ++) a[i] = ...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
94194d5d22982083a3196dda8914d649
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.io.*; import java.util.*; public class Template implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); void init() throws FileNotFoundException { try { in = new BufferedReader(new FileReader("input.txt")); o...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
a3996a78a957849fc4c8cbd603d7e4a5
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.io.Reader; import java.util.InputMismatchException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; /** * Built using CHelper plug-in * Actual solution ...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
dcfae21c410ef9fe84e55accff15afbe
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; public class B390 { public static void main(String[] args) { BigInteger happiness = BigInteger.valueOf(0); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; f...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
b542945b4e89bd56814bc38bda257fdc
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
//package codeforces; import java.util.Scanner; public class Music { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n = in.nextInt(); long A[] = new long[n]; long B[] = new long[n]; long joy = 0; for (int i=0;i < n;i++) A[i] = in...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
49fc0500580158ca4e6508c3fb1d7fcb
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
3341b5e7cc4e834ad1ab57d6e13da9a7
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
96e50cd82724b7f76d65f215d8f6b57a
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
711ae9e9babd86f6f7264002e7bf5d67
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
//package round229; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class B { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); int...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
291cad6a72c05b69cafe6274fb8ff45e
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
419983d1c47f3b5fe0f811fb40e769ed
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); Scanner s = new Scanner(System.in); int n = Integer...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
cf39ef75f357a56aaba2f4f71ef699cd
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
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 hbayramov */ public class Main { public static void main(String[] args) { InputStream...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
4e23fb0d322046c1bcfeda908d483424
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.util.*; public class GFG { public static void main (String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); long a[]=new long[n]; long b[]=new long[n]; int i; for(i=0;i<n;i++){ a[i]=sc.nextLong(); } for(i=0;i<n;i++){ b[i]=sc.nextLong(); } long sum=0; for(...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
99cfe0df85648c2bd8eb7bd1591e30cf
train_001.jsonl
1392132600
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much. A song is a sequence of notes. Dima and Inna want to play each note at the same time. At that, they can play the i-th note at volu...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sn = new Scanner(System.in); int n = sn.nextInt(); long[] note_max = new long[n]; long[] note_target = new long[n]; for (int i = 0; i < n; ++i) note_max[i] = sn.nextL...
Java
["3\n1 1 2\n2 2 3", "1\n2\n5"]
1 second
["4", "-1"]
NoteIn the first sample, Dima and Inna play the first two notes at volume 1 (1 + 1 = 2, the condition holds), they should play the last note at volumes 1 and 2. Sereja's total joy equals: 1·1 + 1·1 + 1·2 = 4.In the second sample, there is no such pair (x, y), that 1 ≤ x, y ≤ 2, x + y = 5, so Dima and Inna skip a note. ...
Java 8
standard input
[ "implementation" ]
986a7d97e62856d5301d5a70ea01466a
The first line of the input contains integer n (1 ≤ n ≤ 105) — the number of notes in the song. The second line contains n integers ai (1 ≤ ai ≤ 106). The third line contains n integers bi (1 ≤ bi ≤ 106).
null
In a single line print an integer — the maximum possible joy Sereja feels after he listens to a song.
standard output
PASSED
2787b243c0b5938e395e8bf0b4ba85a0
train_001.jsonl
1415205000
In a kindergarten, the children are being divided into groups. The teacher put the children in a line and associated each child with his or her integer charisma value. Each child should go to exactly one group. Each group should be a nonempty segment of consecutive children of a line. A group's sociability is the maxim...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["5\n1 2 3 1 2", "3\n3 3 3"]
2 seconds
["3", "0"]
NoteIn the first test sample one of the possible variants of an division is following: the first three children form a group with sociability 2, and the two remaining children form a group with sociability 1.In the second test sample any division leads to the same result, the sociability will be equal to 0 in each grou...
Java 11
standard input
[ "dp", "greedy", "data structures" ]
406fadc8750f8ef32551916d474ae143
The first line contains integer n — the number of children in the line (1 ≤ n ≤ 106). The second line contains n integers ai — the charisma of the i-th child ( - 109 ≤ ai ≤ 109).
2,400
Print the maximum possible total sociability of all groups.
standard output
PASSED
ea8405edb6f2b0820e067330927df904
train_001.jsonl
1416238500
A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the i-th rest point the distance from the start equals xi, and its picturesqueness e...
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.List; import java.util.StringTokenizer; public class Main { public static void main(String...
Java
["5 9\n10 10\n20 10\n30 1\n31 5\n40 10"]
1 second
["1 2 4 5"]
NoteIn the sample test the minimum value of relative total frustration approximately equals 0.097549. This value can be calculated as .
Java 7
standard input
[ "dp", "binary search" ]
9ea7a7b892fefaaf8197cf48e92eb9f1
The first line of the input contains integers n, l (1 ≤ n ≤ 1000, 1 ≤ l ≤ 105) — the number of rest points and the optimal length of one day path. Then n lines follow, each line describes one rest point as a pair of integers xi, bi (1 ≤ xi, bi ≤ 106). No two rest points have the same xi, the lines are given in the orde...
2,300
Print the traveler's path as a sequence of the numbers of the resting points he used in the order he used them. Number the points from 1 to n in the order of increasing xi. The last printed number must be equal to n.
standard output
PASSED
c07e67d7a1987ea9c8d5a6d1fc6c08a8
train_001.jsonl
1416238500
A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the i-th rest point the distance from the start equals xi, and its picturesqueness e...
256 megabytes
import java.util.*; public class e { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(), l = input.nextInt(); int[] xs = new int[n], bs = new int[n]; last = new int[n]; for(int i = 0; i<n; i++) { xs[i] = input.nextInt(); bs[i]...
Java
["5 9\n10 10\n20 10\n30 1\n31 5\n40 10"]
1 second
["1 2 4 5"]
NoteIn the sample test the minimum value of relative total frustration approximately equals 0.097549. This value can be calculated as .
Java 7
standard input
[ "dp", "binary search" ]
9ea7a7b892fefaaf8197cf48e92eb9f1
The first line of the input contains integers n, l (1 ≤ n ≤ 1000, 1 ≤ l ≤ 105) — the number of rest points and the optimal length of one day path. Then n lines follow, each line describes one rest point as a pair of integers xi, bi (1 ≤ xi, bi ≤ 106). No two rest points have the same xi, the lines are given in the orde...
2,300
Print the traveler's path as a sequence of the numbers of the resting points he used in the order he used them. Number the points from 1 to n in the order of increasing xi. The last printed number must be equal to n.
standard output
PASSED
20ad63b3949969fddc966834f901cec2
train_001.jsonl
1416238500
A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the i-th rest point the distance from the start equals xi, and its picturesqueness e...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) { Cf489E tmp=new Cf489E(); tmp.solve(); } } class Cf489E { static final int N=1005; static final double inf=1000000009; double x[]=new double[N]; double b[]=new double[N]; double f[]=new double[N]; int path[...
Java
["5 9\n10 10\n20 10\n30 1\n31 5\n40 10"]
1 second
["1 2 4 5"]
NoteIn the sample test the minimum value of relative total frustration approximately equals 0.097549. This value can be calculated as .
Java 7
standard input
[ "dp", "binary search" ]
9ea7a7b892fefaaf8197cf48e92eb9f1
The first line of the input contains integers n, l (1 ≤ n ≤ 1000, 1 ≤ l ≤ 105) — the number of rest points and the optimal length of one day path. Then n lines follow, each line describes one rest point as a pair of integers xi, bi (1 ≤ xi, bi ≤ 106). No two rest points have the same xi, the lines are given in the orde...
2,300
Print the traveler's path as a sequence of the numbers of the resting points he used in the order he used them. Number the points from 1 to n in the order of increasing xi. The last printed number must be equal to n.
standard output
PASSED
56ce3b5f5129f70aa1178b80ef8204ba
train_001.jsonl
1416238500
A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the i-th rest point the distance from the start equals xi, and its picturesqueness e...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) { Cf489E tmp=new Cf489E(); tmp.solve(); } } class Cf489E { static final int N=1005; static final double inf=1000000009; double x[]=new double[N]; double b[]=new double[N]; dou...
Java
["5 9\n10 10\n20 10\n30 1\n31 5\n40 10"]
1 second
["1 2 4 5"]
NoteIn the sample test the minimum value of relative total frustration approximately equals 0.097549. This value can be calculated as .
Java 7
standard input
[ "dp", "binary search" ]
9ea7a7b892fefaaf8197cf48e92eb9f1
The first line of the input contains integers n, l (1 ≤ n ≤ 1000, 1 ≤ l ≤ 105) — the number of rest points and the optimal length of one day path. Then n lines follow, each line describes one rest point as a pair of integers xi, bi (1 ≤ xi, bi ≤ 106). No two rest points have the same xi, the lines are given in the orde...
2,300
Print the traveler's path as a sequence of the numbers of the resting points he used in the order he used them. Number the points from 1 to n in the order of increasing xi. The last printed number must be equal to n.
standard output
PASSED
463c138cb9b46336cc3cea1a8bf5edce
train_001.jsonl
1416238500
A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the i-th rest point the distance from the start equals xi, and its picturesqueness e...
256 megabytes
import java.util.ArrayList; import java.io.InputStream; import java.io.InputStreamReader; import java.util.List; import java.io.BufferedReader; import java.math.BigInteger; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Collections; import java.io.IOException; import java.util.StringTokenizer...
Java
["5 9\n10 10\n20 10\n30 1\n31 5\n40 10"]
1 second
["1 2 4 5"]
NoteIn the sample test the minimum value of relative total frustration approximately equals 0.097549. This value can be calculated as .
Java 7
standard input
[ "dp", "binary search" ]
9ea7a7b892fefaaf8197cf48e92eb9f1
The first line of the input contains integers n, l (1 ≤ n ≤ 1000, 1 ≤ l ≤ 105) — the number of rest points and the optimal length of one day path. Then n lines follow, each line describes one rest point as a pair of integers xi, bi (1 ≤ xi, bi ≤ 106). No two rest points have the same xi, the lines are given in the orde...
2,300
Print the traveler's path as a sequence of the numbers of the resting points he used in the order he used them. Number the points from 1 to n in the order of increasing xi. The last printed number must be equal to n.
standard output
PASSED
c0c611e8e4ab3342b31ef855500a3016
train_001.jsonl
1416238500
A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the i-th rest point the distance from the start equals xi, and its picturesqueness e...
256 megabytes
//package round277h; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class E { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), L = ...
Java
["5 9\n10 10\n20 10\n30 1\n31 5\n40 10"]
1 second
["1 2 4 5"]
NoteIn the sample test the minimum value of relative total frustration approximately equals 0.097549. This value can be calculated as .
Java 7
standard input
[ "dp", "binary search" ]
9ea7a7b892fefaaf8197cf48e92eb9f1
The first line of the input contains integers n, l (1 ≤ n ≤ 1000, 1 ≤ l ≤ 105) — the number of rest points and the optimal length of one day path. Then n lines follow, each line describes one rest point as a pair of integers xi, bi (1 ≤ xi, bi ≤ 106). No two rest points have the same xi, the lines are given in the orde...
2,300
Print the traveler's path as a sequence of the numbers of the resting points he used in the order he used them. Number the points from 1 to n in the order of increasing xi. The last printed number must be equal to n.
standard output
PASSED
ad87425addcf5da2f45568573bd03bee
train_001.jsonl
1416238500
A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the i-th rest point the distance from the start equals xi, and its picturesqueness e...
256 megabytes
import java.io.*; import java.util.*; public class hiking { private static Reader in; private static PrintWriter out; public static double[][] dist; public static void main(String[] args) throws IOException { in = new Reader(); out = new PrintWriter(System.out, true); N = in.nextInt(); L = ...
Java
["5 9\n10 10\n20 10\n30 1\n31 5\n40 10"]
1 second
["1 2 4 5"]
NoteIn the sample test the minimum value of relative total frustration approximately equals 0.097549. This value can be calculated as .
Java 7
standard input
[ "dp", "binary search" ]
9ea7a7b892fefaaf8197cf48e92eb9f1
The first line of the input contains integers n, l (1 ≤ n ≤ 1000, 1 ≤ l ≤ 105) — the number of rest points and the optimal length of one day path. Then n lines follow, each line describes one rest point as a pair of integers xi, bi (1 ≤ xi, bi ≤ 106). No two rest points have the same xi, the lines are given in the orde...
2,300
Print the traveler's path as a sequence of the numbers of the resting points he used in the order he used them. Number the points from 1 to n in the order of increasing xi. The last printed number must be equal to n.
standard output
PASSED
cc40b1bc7b348fac77ca8701e4a09c53
train_001.jsonl
1416238500
A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the i-th rest point the distance from the start equals xi, and its picturesqueness e...
256 megabytes
import java.util.List; import java.util.Scanner; import java.io.OutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Anudeep Nekkanti */...
Java
["5 9\n10 10\n20 10\n30 1\n31 5\n40 10"]
1 second
["1 2 4 5"]
NoteIn the sample test the minimum value of relative total frustration approximately equals 0.097549. This value can be calculated as .
Java 7
standard input
[ "dp", "binary search" ]
9ea7a7b892fefaaf8197cf48e92eb9f1
The first line of the input contains integers n, l (1 ≤ n ≤ 1000, 1 ≤ l ≤ 105) — the number of rest points and the optimal length of one day path. Then n lines follow, each line describes one rest point as a pair of integers xi, bi (1 ≤ xi, bi ≤ 106). No two rest points have the same xi, the lines are given in the orde...
2,300
Print the traveler's path as a sequence of the numbers of the resting points he used in the order he used them. Number the points from 1 to n in the order of increasing xi. The last printed number must be equal to n.
standard output
PASSED
31bab8e414d6e29f94ac64d9573b9a5c
train_001.jsonl
1416238500
A traveler is planning a water hike along the river. He noted the suitable rest points for the night and wrote out their distances from the starting point. Each of these locations is further characterized by its picturesqueness, so for the i-th rest point the distance from the start equals xi, and its picturesqueness e...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author George Marcus */ public class Main { public static void mai...
Java
["5 9\n10 10\n20 10\n30 1\n31 5\n40 10"]
1 second
["1 2 4 5"]
NoteIn the sample test the minimum value of relative total frustration approximately equals 0.097549. This value can be calculated as .
Java 7
standard input
[ "dp", "binary search" ]
9ea7a7b892fefaaf8197cf48e92eb9f1
The first line of the input contains integers n, l (1 ≤ n ≤ 1000, 1 ≤ l ≤ 105) — the number of rest points and the optimal length of one day path. Then n lines follow, each line describes one rest point as a pair of integers xi, bi (1 ≤ xi, bi ≤ 106). No two rest points have the same xi, the lines are given in the orde...
2,300
Print the traveler's path as a sequence of the numbers of the resting points he used in the order he used them. Number the points from 1 to n in the order of increasing xi. The last printed number must be equal to n.
standard output