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
ec11ff157c9c50affc8c0f46764fe179
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; /** * @author Don Li */ public class MikeGeometryProblem { static final int MOD = (int) (1e9 + 7); static final int MAXN = (int) (2e5 + 5); static final l...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
7efede3b685f38e6dcc4ff18b41c4cd4
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.util.TreeMap; /** * @author Don Li */ public class MikeGeometryProblem { static final int MOD ...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
66fd074c6f7cc2775c2648d3a58ac6c9
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
/** * @author mu * */ import java.io.PrintWriter; import java.util.Arrays; // Trick CF: public class Scanner { private java.io.BufferedReader bufferedReader; private java.util.StringTokenizer stringTokenizer; public Scanner(java.io.InputStream inputStream) { bufferedReader = new java.io.Buffer...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
30d18817821a81e438acf5a855ff1a27
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
// package cf.contest689.e; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; // Trick CF: public class Scanner { private java.io.BufferedReader bufferedReader; private java.util.StringTokenizer stringTokenizer; ...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
adbd55813afbcf5b115dfdce215ef20e
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
// practice with rainboy import java.io.*; import java.util.*; public class CF689E extends PrintWriter { CF689E() { super(System.out); } static class Scanner { Scanner(InputStream in) { this.in = in; } InputStream in; int k, l; byte[] bb = new byte[1 << 15]; byte getc() { if (k >= l) { k = 0; try { ...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
94f9bce601b86b211312263e38b6066e
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.LinkedList; import java.util.Map.Entry; import java.util.Arrays; import java.util.Queue; import java.util.StringTokenizer; import java.util.TreeMap; impor...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
e312250cd3b1f458ea3ba89033d5ce90
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.math.BigInteger; import java.util.Arrays; public class E { private static class Event implements Comparable<Event> { public int idx; public int type; public int location; publ...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
24b6a55b6e280500ae0c6d19c1c8eaa1
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import java.io.*; import java.util.*; public class e { static class Point implements Comparable<Point>{ int x; int type; Point(int _x, int _type){ x = _x; type = _type; } @Override public int compareTo(Point o) { if (o.x == this.x){ return this.type - o.type; } else{ return thi...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
bb8a53ccc470baab964b939e04c69576
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
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 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
d1d357b04572e475a62f5e7eaf5c6dd9
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
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 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
69d4e85b5cd97d7e53caa0f1c809cc9d
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import com.sun.org.apache.xml.internal.utils.StringComparable; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.*; public class Main { public static void main(String[] args) { // Test.te...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
6b8134d5d98e7ea0ea8ae090875b2091
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
// package codeforces.cf3xx.cf361.div2; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; /** * Created by hama_du on 2016/08/09. */ public class E { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintW...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
1375cc8ab1d3998923c28849724ad0a0
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.StringTokenizer; import java.util.TreeSet; public class E361 { static int N; static final long MOD = 1_000_000_007; static long[] fact, modinv; public static void main(String[] a...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
cca22c9e55df52e510d0a39ceb230245
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { public static final long P = 1000000007; public static long[] pre; public static long inv( long a ) { a = a % P; long res = 1; for ( long p = P - 2; p > 0; p >>= 1 ) { if ( p % 2 == 1 ) res = ( res * a ) % P; a = ( a *...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
9467d14d31c39a131b80432ff719aa36
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
//package round361; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; public class E { InputStream is; PrintWriter out; String INPUT = ""; void sol...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
5b550c749d772100067863790a63366f
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Main { private FastScanner in; private PrintWriter out; // private Timer timer = new Timer(); class E { int pos, type; static final int START = 1; static final int END = 0; public...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
3c668514f84c45d68764f64ca35210ef
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import static java.lang.Math.*; import static java.util.Arrays.*; import java.util.*; import java.io.*; public class Main { void solve() { int N = sc.nextInt(); int K = sc.nextInt(); int[] a = new int[N]; int[] b = new int[N]; for (int i = 0; i < N; i++) { a[i] = sc.nextInt(); b[i] = sc.nextInt() + ...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
defb56fbb4f0470c1ad733eb5980ae6e
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import java.util.*; import java.util.function.Supplier; import java.io.*; import java.awt.Point; import java.math.BigDecimal; import java.math.BigInteger; import static java.lang.Math.*; public class __AAAAA implements Runnable{ final static Random rnd = new Random(); // SOLUTION!!! // HACK ME PLEASE IF YOU ...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
752547d2f41a6deed98453b38d7aaf44
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import java.io.ByteArrayInputStream; import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; import java.util.TreeMap; import java.util.concurrent.ThreadLocalRandom; public class Main { public static void main(String[] args) { long startTime = System.currentTimeMillis(); new M...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
f7e0318445f7853a3e7a854bf05205e6
train_001.jsonl
1467822900
Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define f([l, r]) = r - l + 1 to be the number of integer points in the segment [l, r] with l ≤ r (say that ). You are given two integers n and k and n closed intervals [li, ri] on OX axis and you h...
256 megabytes
import java.util.ArrayList; import java.io.InputStream; import java.io.InputStreamReader; import java.util.List; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Collections; import java.util.Comparator; import java.io.IOException; import java.util.StringTokenizer...
Java
["3 2\n1 2\n1 3\n2 3", "3 3\n1 3\n1 3\n1 3", "3 1\n1 2\n2 3\n3 4"]
3 seconds
["5", "3", "6"]
NoteIn the first example: ;;.So the answer is 2 + 1 + 2 = 5.
Java 8
standard input
[ "dp", "geometry", "combinatorics", "implementation", "data structures" ]
900c85e25d457eb8092624b1d42be2a2
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 200 000) — the number of segments and the number of segments in intersection groups respectively. Then n lines follow, the i-th line contains two integers li, ri ( - 109 ≤ li ≤ ri ≤ 109), describing i-th segment bounds.
2,000
Print one integer number — the answer to Mike's problem modulo 1000000007 (109 + 7) in the only line.
standard output
PASSED
ff09a39e6bd11702ee38a7c6ac3a1daf
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); long k = scanner.nextInt(); long m = scanner.nextInt(); int[] a = new int[n]; long s = 0; for(int i = 0; i < n ; ++i...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
3ed6df6d938e5c3be79a8c6c15d74add
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); long k = scanner.nextInt(); long m = scanner.nextInt(); int[] a = new int[n]; long s = 0; for(int i = 0; i < n ; ++i...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
5141eebe06a5b4c00eaa369a726185c0
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class B2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), k = sc.nextInt(), m = sc.nextInt(); // New idea: instead of simu...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
b663fd54bedddb676f3b12017e0c7016
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.*; public class AverageSuperheroGangPower { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); long k = scan.nextInt(); int m = scan.nextInt(); Long[] arr = new Long[n]; for(int i = 0; i < n; i++) arr[i] = (long) scan.nextInt(); Arr...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
9b6509145af856f25c206648bfffaa9f
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
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
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
95357c585e083dc9b223cd79e44e9c70
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class CodeForces { class FastScanner { StringTokenizer tok = new StringTokenizer(""); BufferedReader in; FastScanner() { in = new BufferedReader(new InputStre...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
a350d6c7b2d2e6c8fa66ab33dfdfc026
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
// package trial; import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { InputReader s=new InputReader(System.in); PrintWriter w=new PrintWriter(System.out); int n,k,m; n=s.nextInt(); k=s.nextInt(); m=s.nextInt(); Integer arr[]=new Integer[n]; for(int i=0...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
e01f3c472f15d5da80cabb6fefc9b714
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import java.util.concurrent.ThreadLocalRandom; public class Solver { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); long k = s.nextInt(); long m = s.nextInt(); long[] a = ne...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
6402772f08a0a43367f26a591c38879f
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.math.*; import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer stk = new StringTokenizer(br.readLine()); int n = Integer.parseI...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
f53ab0977649df4bf2c054bba7bb2900
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
/*Author: Satyajeet Singh, Delhi Technological University*/ import java.io.*; import java.util.*; import java.text.*; import java.lang.*; public class Main { /*********************************************Constants******************************************/ static PrintWriter out=new PrintWriter(new OutputStreamWr...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
68a8f41f3cb00e622e368ee70cebadfa
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class AverageSuperheroGangPower { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long k = sc.nextInt(); long m = sc.nextInt(); long sum = 0; long num; sc.nextLine(); long [] input = new long...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
152caef7968a5a58b9baaa5b91b28569
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
/* ⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⡎...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
272e04b46bb416d045742eaf51a3721f
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.*; import java.util.Arrays; public class Main { private static final boolean FROM_FILE = false; private static final boolean TO_FILE = false; public static void main(String[] args) throws IOException { BufferedReader br; if (FROM_FILE) { br = new BufferedReader(...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
a83f0a33478f7c5f4d1b85c0b6d107de
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.*; public class main{ static int MAX = 100010; static long MOD = 1000000007; static ArrayList<Integer>[] amp; public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(), k = sc.nextInt(), m = sc.nextInt();//, b = sc.nextInt(); int arr[] = new int[n]; ...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
e6096141e126336d37a9d62ec057bea2
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; public class F474 { BufferedReader br; StringTokenizer in; PrintWriter ...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
a381bd5f0d998c0ecbee202156cb3852
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.util.*; import java.io.*; public class Main { static int min[]; static int cnt[]; static int strength[]; static int GCD(int a, int b){ if (a < b){ int temp = a; a = b; b = temp; } if(b == 0)return a; return GCD(b,a%b); } public static void main(String [] args)throws Exception{ BufferedReader br...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
958222ba7ab43e1cc4acb281585b76c7
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.util.*; import java.io.*; public class f { public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(); aa = new int[n]; for(int i = 0; i<n; i++) aa[i] = input.nextInt(); IT it = new IT(n); ...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
33d5cd6854d47a5260b2943a55dafd1f
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.io.*; import java.util.*; public class Main { static SegTree gcdTree ; public static void main(String[] args) { int array[]; int n ; MyScanner sc = new MyScanner(); MyWriter mw = new MyWriter(); n = sc.nextInt(); array = new int[n]; for(int i = 0 ; i < n ; ++i ) arr...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
62913b46014a01cceac032996e176455
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class Assert { static void check(boolean e) { if (!e) { throw new Error(); } } } static class Scanner { StreamTokenizer in; Scanner(Reader r) { in = new StreamTokenizer(new BufferedReader(r)); in.resetSyntax(); ...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
6f3ff85f9c4b66176f85d34b2518f68a
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
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.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Com...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
07d92c6652995f7a735d532c43e98add
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class F { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); ...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
92facb24a8633dc044b654872da27938
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; /** * Created by hama_du on 2014/10/09. */ public class ProblemF { static int gcd(int a, int b) { return b == 0 ? a : gcd(b, a%b); } public stat...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
bff0dd3a441054529fa0dae43dbdb4b7
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub InputReader in = new InputReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); new Task().go(in, out); out.c...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
a2279ad1b0c5ba2403d995d240d60b87
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.io.*; import java.util.*; public class Main{ final boolean isFileIO = false; BufferedReader in; PrintWriter out; StringTokenizer st = new StringTokenizer(""); String delim = " "; public static void main(String[] args) throws IOException { Main m = new Main(); m.ini...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
53527282889a7f544c71e99fe0d792a6
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; public class F { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
8fbd0a8b7972a3d052e2a2062fb783ca
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
//package round271; 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 F2 { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); in...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
d6addfc5ac72c0eb3d57599cd883010b
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
//package round271; 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 F3 { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); in...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
a32f204e95f155ff84bb160950c69335
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.StringTokenizer; public class F { public static void main(String[] args) throws Exception { int len = ...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
94c1aea0a60f21a1a382b39f55996344
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static boolean home = true; public static void main(String[] args) throws FileNotFoundException { InputStream is = home ? System.in : new FileInputStream("decoding.in"); InputReader in = new InputReader(is);...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
494698a376673a79a9cd3512de269fbd
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static ...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
4fb059dc0fb75b31658e164f58711771
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.io.IOException; import java.util.InputMismatchException; import java.util.ArrayList; import java.util.HashMap; 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 M...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
c870d30c7685a9ffafa72fea7ac020b7
train_001.jsonl
1412609400
Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n) has a strength si.In order to make his dinner more interesting, Mole organizes a version of «Hunger Games» for the ants. He chooses two numbers l and r (1 ≤ l ≤ r ≤ n) and each pair of ants with indices between...
256 megabytes
import java.util.*; import java.io.*; public class TaskE { private FastScanner in; private PrintWriter out; class Tree { private int size; private int[] tree; private int diff; Tree(int[] data) { size = 1; while (size < data.length) { ...
Java
["5\n1 3 2 4 2\n4\n1 5\n2 5\n3 5\n4 5"]
1 second
["4\n4\n1\n1"]
NoteIn the first test battle points for each ant are v = [4, 0, 2, 0, 2], so ant number 1 is freed. Mole eats the ants 2, 3, 4, 5.In the second test case battle points are v = [0, 2, 0, 2], so no ant is freed and all of them are eaten by Mole.In the third test case battle points are v = [2, 0, 2], so ants number 3 and ...
Java 7
standard input
[ "data structures", "number theory", "math" ]
f7f1d57921fe7b7a697967dcfc8f0169
The first line contains one integer n (1 ≤ n ≤ 105), the size of the ant colony. The second line contains n integers s1, s2, ..., sn (1 ≤ si ≤ 109), the strengths of the ants. The third line contains one integer t (1 ≤ t ≤ 105), the number of test cases. Each of the next t lines contains two integers li and ri (1 ≤ ...
2,100
Print to the standard output t lines. The i-th line contains number of ants that Mole eats from the segment [li, ri].
standard output
PASSED
4c9a12f11b359eae2371be1a7e91f79f
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.*; import java.lang.*; public class Cf { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); double w,temp; w=in.nextDouble(); int i,j,k; double a[] = new double[n]; double b[] = new double[...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
0a9e35f907276d623966b52c46595f9c
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class Main { BufferedReader br; StringTokenizer in; PrintWriter pw; public void solve() throws IOException { int n = nextInt(); double m = nextInt(); int a[] = new int[n]...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
5690446e0c6baca60c8ac1681c308d2d
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class CF499C { private static boolean test = false; private static InputReader in = new InputReader(System.in); public ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
17232414b687b78f6af6b037959f4ae0
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package Round499; import java.util.Scanner; /** * * @author Hemant Dhanuka */ public class C1 { static int n,m,lowerLimit; ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
11f873b4a0f694dfbb61a402f45a13ff
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package Round499; import java.util.Scanner; /** * * @author Hemant Dhanuka */ public class C3 { static int n,m,lowerLimit; ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
ff90c2af4de1cbc0320c23615b3bfb88
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package Round499; import java.util.Scanner; /** * * @author Hemant Dhanuka */ public class C2 { static int n; static int...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
43bdc039b9e9e2f046429ea6208a480c
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; public class A { ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
3b26ed1b921e703ab9656c806040b7bc
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; public class A { ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
78e92747487edfa624934662ff058111
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
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 C { InputStream is; PrintWriter out; String INPUT = "6\n" + "2\n" + "4 6 3 3 5 6\n" + "2 6 3 6 5 3\n" +...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
f4f5f23dd48d21b64b256f1a4d65bee9
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
d4d31ed355ca02c28ef55f667b27a626
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.*; import java.io.*; public class Fly{ static int N, M, K; static String s; static StringTokenizer st; static int[] d; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
7fa6df556a4e30509d3bb3038b8af82c
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.*; import java.io.*; public class Fly { static int N, M, K; static String s; static StringTokenizer st; static int[] d; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
113ebefe56bff544e6c507a08afb070c
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { //System.out.println("GfG!"); Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); int a[]=new int[n]; int b[]=new int[n]; for(i...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
b41e970b33a5b62ce34ec7868a1f2d1a
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.*; public class test{ static double arr[]; static double arr1[]; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); double c = sc.nextDouble(); double ans=-1; arr = new double[n]; arr1 = new...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
52d366537297ef3e84cf3c4acbaa0db2
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.text.DecimalFormat; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.text.NumberFormat; import java.io.In...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
a175589516eef66154bf46d30565bff2
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.Scanner; public class Fuel { public static void main(String args[]) {Scanner s=new Scanner(System.in); int n=s.nextInt(),m=s.nextInt(); int a[]=new int[n]; int b[]=new int[n]; for(int i=0;i<n;i++) { a[i]=s.nextInt(); } for(int ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
3279787441fe47dc6d0e918cc1bb2824
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.io.BufferedInputStream; import java.util.Scanner; /** * */ public class Contest_C { public static void main(String[] args) { Scanner in = new Scanner(new BufferedInputStream(System.in)); while (in.hasNext()) { int n = in.nextInt(); // planet cnt double m = in....
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
ccd2f4d1b1ccfc935eb2f5179c931a6e
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Don Li */ public class Fly2 { int n, m; int[] a, b; void solve() { n = in.nextInt(); m = in.nextInt(); a = new...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
7046b056cc17578cda5afc9c19319aeb
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Don Li */ public class Fly { double INF = 1e9 + 100; double EPS = 1e-9; int n, m; int[] a, b; void solve() { ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
3c4f5901f0ad979d178da2c6e310485e
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.Scanner; public class CCCC { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); int m=scan.nextInt(); int a[]=new int[n]; for(int i=0;i<n;i++) { a[i]=scan.nextInt(); if(a[i]<=1) { System.out.println(-1); return; }...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
9d88f9e86dfe66cff8248ba1faf4f0dd
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.*; import static java.lang.Math.*; import java.util.function.Function; // Java 8 and up public class C { public static void main(String []av) { Scanner s = new Scanner(); int n = s.nextInt(); final int rocket = s.nextInt(); ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
402a4dc72c0f30b36762b533c59794f3
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.BigInteger; public class R499C { public static void main (String[] args) throws java.lang.Exception { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(), m ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
d3ef3e27a030118130b8ab9db3c05f3f
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Solution solution = new Solution(); System.out.println(solution.solve()); } private double solve() { Scanner in = new Scanner(System.in); int n = in.nextInt() * 2; int m = in.nextInt(); int[] a = new int[n]; d...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
4092c989296b068fa0b89667a45ad280
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
//package math_codet; import java.io.*; import java.util.*; /****************************************** * AUTHOR: AMAN KUMAR SINGH * * INSTITUITION: KALYANI GOVERNMENT ENGINEERING COLLEGE * ******************************************/ public class lets_do { InputReader in; PrintWriter o...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
194969f94589db4b7fb995cda5bec082
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.util.regex.Pattern; import java.io.*; import java.math.BigInteger; public class MainClass { public static void main(String[] args) { FastReader in = new FastReader(); int n = in.nextInt(), m = in.nextInt(); double a[] = new double[n...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
ff024ad84da57e40a33590c35037186d
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.*; public class PE { public static void main(String argsp[]) { Scanner s = new Scanner(System.in); int n=s.nextInt(); double m=s.nextDouble(); double ng=m,a=0.0; for(int x=0;x<(n<<1);x++) { int aa=s.nextInt(); if(aa==1||ng-m>1e9) { System.out.println(-1); System.exit(0);...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
e42144af73dae422cf685cddd65d1c11
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.*; public class PE { public static void main(String argsp[]) { Scanner s = new Scanner(System.in); int n=s.nextInt(); double m=s.nextDouble(); double ng=m,a=0.0; for(int x=0;x<(n<<1);x++) { int aa=s.nextInt(); if(aa==1) { System.out.println(-1); System.exit(0); } n...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
67fb680d5e0b03ccffcef363e81332dc
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
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.FileReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelp...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
601d9d17622343e47aed17c727487d87
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.File; import java.io.InputStream; /** * Built usin...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
18998f1a3d1d6c8d0609e0a46d495da8
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.* ; import java.io.BufferedReader ; import java.io.InputStreamReader ; public class Fly { public static void main(String args[]) throws Exception { BufferedReader bro = new BufferedReader(new InputStreamReader(System.in)) ; int N = Integer.parseInt(bro.readLine()) ; int...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
c5233b11ee22dd8af497a627e0fe21be
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.io.*; import java.util.*; public class Main { private final static long mod = 1000000007; private static void printArr2(long arr[][]) { int i, j, n = arr.length, m = arr[0].length; for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { System.out.print(arr...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
451db91c34c46d8e66b1ac5298b8a8aa
train_001.jsonl
1532617500
Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $$$n - 2$$$ intermediate planets. Formally: we number all the planets from $$$1$$$ to $$$n$$$. $$$1$$$ is Earth, $$$n$$$ is Mars. Natasha will make exactly $$$n$$$ flights: $$$1 \to 2 \to \ldots n \to 1$$$.Flight...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class A { static Scanner s = new Scanner(System.in); public static void main(String[] args) { try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) { int n = Integer.parseInt(reader.readLine()); double ...
Java
["2\n12\n11 8\n7 5", "3\n1\n1 4 1\n2 5 3", "6\n2\n4 6 3 3 5 6\n2 6 3 6 5 3"]
1 second
["10.0000000000", "-1", "85.4800000000"]
NoteLet's consider the first example.Initially, the mass of a rocket with fuel is $$$22$$$ tons. At take-off from Earth one ton of fuel can lift off $$$11$$$ tons of cargo, so to lift off $$$22$$$ tons you need to burn $$$2$$$ tons of fuel. Remaining weight of the rocket with fuel is $$$20$$$ tons. During landing on Ma...
Java 8
standard input
[ "binary search", "greedy", "math" ]
d9bd63e03bf51ed87ba73cd15e8ce58d
The first line contains a single integer $$$n$$$ ($$$2 \le n \le 1000$$$) — number of planets. The second line contains the only integer $$$m$$$ ($$$1 \le m \le 1000$$$) — weight of the payload. The third line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 1000$$$), where $$$a_i$$$ is the numbe...
1,500
If Natasha can fly to Mars through $$$(n - 2)$$$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $$$-1$$$. It is guaranteed, that if Natasha can make a flight, then it takes no more than $$$10^9$$$ tons of fuel. The answer will be consider...
standard output
PASSED
9250a3c4d57a8737bc0bd7dcdaa673b8
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.*; public class Coder { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int total = sc.nextInt(); if(total==1){ System.out.println("1"); System.out.println("C"); return; } char[][] arr = new char[total][total]; int sum=0; for(int i=0;i<2;i++){ f...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
aec6d811df50a930cc6d83c80698bf0f
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int no=sc.nextInt(); int b[]= new int [1001]; int fac=0; b[0]=1; for(int i=2;i<1001;i++){ b[i]=b[i-2]+4*(fac); fac++; i++; } ...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
903dfbd108dd99e26eca9f58c31480c2
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.Scanner; public class zransom { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int y = (int) Math.ceil((Math.pow(a, 2)) / 2); String[][] p = new String[(int) a][(int) a]; System.out.println(y); Stri...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
43cb91b9b95f813c2801ee10f2471605
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; @SuppressWarnings("unused") public class A { public static Scanner scan = new Scanner(System.in); public static void solve () { int n=scan.nextInt(); StringBuilder s= new StringBuilder(); int cnt...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
c02d152fa706e5ce4d190cde9a42213b
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.lang.*; public class P384A { //static long m=1000000007; static BigInteger ways(int N, int K) { BigInteger ret = BigInteger.ONE; for(int i=N;i>=N-K+1;i--) { ...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
b9e93d8bc71cd9f3f53211ef9dc71791
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Coder { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(reader.readLine()); System.out....
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
e706fc9a727a47aca362b9016f1199ad
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.*; public class Car { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String x1 = ""; String x2 = ""; System.out.println((n / 2 + n % 2) * (n / 2 + n % 2) + (n / 2) * (n / 2)); for (int i = 1; i <= n; i++) { if (i % 2 == 1) { x1 +...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
0cb1b3e7a3114fde798557fcadb98552
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); StringBuilder sb = new StringBuilder(); int cnt = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if ((i + j) % 2 == 0) ...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
0a36374826c23fc84823b044069c91a2
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.Scanner; public class Main384A { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { int n = in.nextInt(); System.out.println((n * n + 1) / 2); StringBuilder sb = new StringBuilder(); ...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
244bf5f86ede8302b3698ae796182fd2
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.Scanner; public class JavaApplication119 { public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt(); System.out.println((n*n+1)/2); int c=0; String a = ""; String t = ""; for(int i=0;i<n;i++){ if(i%2=...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
f579112b498606585d9ccca32de297e0
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.*; public class Solution { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); if (n % 2 == 0) System.out.println(n*n/2); if(n % 2 != 0) System.out.println(n*n/2 +1); for (int i = 1; i <= n; i++) { ...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
b83c180f8ee78ecbd7acd7fad87ace1a
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int c = n*n / 2; boolean [][] chess = new boolean [n][n]; int counter = 0; for (int i = 0; i < n; i++) { for (int j...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
368d9dc7fa8c5f6e06c915883508efd9
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out,true); int n = Integer.parseInt(br.readLine()); ...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
83084dc5f48760a7727544f6e1d4affe
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.Scanner; public class Coder { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int max = 0; if(n % 2 == 0){ max = n /2 * n ; }else { int temp = n / 2 ; max = temp * temp + ((temp + 1) *(temp + 1)) ; } System.out.printl...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
380e79f8f8be17a2f043783642f8f773
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.System.*; public class theatre { public static void main(String[]Kowalski) { Scanner in=new Scanner(System.in); int N=in.nextInt(); String[][]mat=new String[N][N]; int c=0; //2=2 //4=8 //6...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output
PASSED
953e2be79d7d97271eafe645aa16fc60
train_001.jsonl
1390231800
Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (x, y), he can move to (or attack) positions (x + 1, y), (x–1, y), (x, y + 1) and (x, y–1).Iahub wants to know how many Co...
256 megabytes
import java.util.Scanner; public class Coder { public static int n=0,count=0; public static String matrix[]; //x =n public static void printChees(){ for(int i=0;i<n;i++){ System.out.println(matrix[i]); } } public static void count...
Java
["2"]
1 second
["2\nC.\n.C"]
null
Java 8
standard input
[ "implementation" ]
1aede54b41d6fad3e74f24a6592198eb
The first line contains an integer n (1 ≤ n ≤ 1000).
800
On the first line print an integer, the maximum number of Coders that can be placed on the chessboard. On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'. If there are multiple correct answers, you can print any.
standard output