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 | fa52c22821395153860e35174cf0db91 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | aebdad70fce020219d3986948b4b73c6 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution{
InputStream is;
static PrintWriter out;
String INPUT = "";
static long mod = (long)1e9+7L;
long[][][] dp;
long[] a;
public void solve(){
int n = ni(), k = ni(), x = ni();
a = new long[n];
for(int i = 0; i < n; i++)a[i] = nl();
dp = new long[... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 2fc3492ea3f91cd1635ecb7e8ade0e0d | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main implements Runnable {
FastReader scn;
PrintWriter out;
String INPUT = "";
void solve() {
int n = scn.nextInt(), k = scn.nextInt(), x = scn.nextInt();
int[] arr = scn.nextIntArray(n);
dp = new long[n + 1][x + 1][k + 1];
long rv = func(arr, 0, x, k, ... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 0edd072a9f819c42989ac11789e2bda8 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main implements Runnable {
FastReader scn;
PrintWriter out;
String INPUT = "";
void solve() {
int n = scn.nextInt(), k = scn.nextInt(), x = scn.nextInt();
int[] arr = new int[n + 1];
for(int i = 1; i <= n; i++) {
arr[i] = scn.nextInt();
}
long[][] dp... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | e781b120aa30295509090c9add96bda1 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int pics = in.nextInt();
int skips = in.nextInt();
int posts = in.nextInt();
int[] arr = new int[pics];
for(int i = 0;i... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 1878e96121fb141bc9ede73ad061672d | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes |
import java.io.*;
import java.util.*;
public class A{
static long INF=(long)1e18;
static long [][][]memo;
static int n,k,a[];
static long dp(int idx,int dis,int left)
{
if(dis==k || left<0)
return -INF;
if(idx==n)
return left==0?0:-INF;
if(memo[idx][dis][left]!=-1)
return memo[idx][dis][left];
... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | ed9c5363d01e7b075a6d691f820782b1 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.*;
import java.util.*;
public class l {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | da8879db96116cd8d0c9cafa7f37983f | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.util.*;
import java.io.*;
import java.util.Map.Entry;
public class Codeforces {
static int[] pic;
static int n, x, k;
static long INF = (long)-1e16;
static long[][][] memo;
public static long dp(int idx, int p, int left){
if(p > x){
return INF;
}
... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | a716cc13f2df113e9628864c3ee701a6 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | /*
USER: caoash3
LANG: JAVA
TASK:
*/
import java.io.*;
import java.util.*;
public class kittens {
static final boolean stdin = true;
static final String filename = "";
static FastScanner br;
static PrintWriter pw;
public static void main(String[] args) throws IOException {
if (stdin) {
br = new FastScan... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 0ccaa6de45d234df158dcf5c4e743c90 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes |
/*
USER: caoash3
LANG: JAVA
TASK:
*/
import java.io.*;
import java.util.*;
public class kittens {
static final boolean stdin = true;
static final String filename = "";
static FastScanner br;
static PrintWriter pw;
public static void main(String[] args) throws IOException {
if (stdin) {
br = new FastSca... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 4eb0fddfd39b103770d9e61e3758f61b | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
static final long MOD = 1_000_000_007, INF = 1_000_000_000_000_000_000L;
static final int INf = 1_000_000_000;
static FastReader reader;
static PrintWriter writer;
public static void main(String[] args) {
... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | edc8a857cc4a9287817f7d208fcfc0a8 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.*;
import java.util.*;
public class Pictures {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] line = br.readLine().split(" ");
int n = Integer.parseInt(line[0]);
int k = Inte... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | a15a1ee3f72c28125d3dbb9eeb5374c7 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
public class Main {
static class RMQ {
long[] data = new long[16384];
public RMQ() {
}
public void init(long[] init) {
Arrays.fill(data, -1);
_init(init, 0, 0, 5002);
}
private void _init(... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 7b0bce0a000a463fdbc378ba0cf82d5a | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static String nextToken() throws IOException {
... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 70637c5f3ec821efab871861a591ee00 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static String nextToken() throws IOException {
... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 81be56d90aa0747e5677e94e1300fd90 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static String nextToken() throws IOException {
... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 1795b7207c900ca657b217a0565ee624 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static String nextToken() throws IOException {
... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 40b63c5f8ba3ec254fe838cfca4e4d4e | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static BufferedReader reader;
static StringTokenizer tokenizer;
static PrintWriter writer;
static String nextToken() throws IOException {
... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 1294c7a5780fb104cbd4f76038ba80dc | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.util.*;
public class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int x = sc.nextInt();
int[] arr = new int[n];
for(int i = 0; i<n; i++)
arr[i] = sc.nextInt();
long[][] grid =... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 38391ee02f40b71e041d7d0f456bef23 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.util.*;
import java.io.*;
public class picturesWithKittensEasy {
static FS sc = new FS();
static PrintWriter pw = new PrintWriter(System.out);
static final long max = Long.MAX_VALUE / 8;
static int n, k, x;
static int[] arr;
static long[][][] dp;
public static void main(String[] args) {
n = sc.... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | f583af4bb515c37d62e71c91387c5972 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.util.*;
import java.io.*;
public class picturesWithKittensEasy {
static FS sc = new FS();
static PrintWriter pw = new PrintWriter(System.out);
static final long max = Long.MAX_VALUE / 8;
static int n, k, x;
static int[] arr;
static long[][] dp;
public static void main(String[] args) {
n = sc.ne... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | f91b7c84160a21febcd5468261566cdb | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.util.*;
import java.io.*;
public class picturesWithKittensEasy {
static FS sc = new FS();
static PrintWriter pw = new PrintWriter(System.out);
static final long max = Long.MAX_VALUE / 8;
static int n, k, x;
static int[] arr;
static long[][] dp;
public static void main(String[] args) {
n = sc.ne... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | c57279a2bb1dd6216c77536a10d11bf5 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | //codeforces_1077F1
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static java.lang.Math.*;
import java.math.*;
public class Main{
static PrintWriter go = new PrintWriter(System.out);
static int n,x,minLength;
static int[] l;
static long[][] memo;
pu... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | b410b9004cd8293b4452905caf42b1ef | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.util.Scanner;
// https://codeforces.com/problemset/problem/1077/F1
public class PicturesWithKittens {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int d = sc.nextInt();
int x = sc.nextInt();
int[] a = new int... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 9e5afa2c108979590c5fd8586d7378a3 | train_001.jsonl | 1542378900 | The only difference between easy and hard versions is the constraints.Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $$... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOExcept... | Java | ["5 2 3\n5 1 3 10 1", "6 1 5\n10 30 30 70 10 10", "4 3 1\n1 100 1 1"] | 2 seconds | ["18", "-1", "100"] | null | Java 8 | standard input | [
"dp"
] | c1d48f546f79b0fd58539a1eb32917dd | The first line of the input contains three integers $$$n, k$$$ and $$$x$$$ ($$$1 \le k, x \le n \le 200$$$) — the number of pictures in the news feed, the minimum length of segment with at least one repost in it and the number of pictures Vova is ready to repost. The second line of the input contains $$$n$$$ integers $... | 1,900 | Print -1 if there is no way to repost some pictures to satisfy all the conditions in the problem statement. Otherwise print one integer — the maximum sum of values of reposted pictures if Vova follows conditions described in the problem statement. | standard output | |
PASSED | 75cc6108af4a3dacdc6c9903fc320e26 | train_001.jsonl | 1407690000 | Piegirl was asked to implement two table join operation for distributed database system, minimizing the network traffic.Suppose she wants to join two tables, A and B. Each of them has certain number of rows which are distributed on different number of partitions. Table A is distributed on the first cluster consisting o... | 256 megabytes | import java.util.List;
import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
pub... | Java | ["2 2\n2 6\n3 100", "2 3\n10 10\n1 1 1"] | 1 second | ["11", "6"] | NoteIn the first example it makes sense to move all the rows to the second partition of the second cluster which is achieved in 2 + 6 + 3 = 11 operationsIn the second example Piegirl can copy each row from B to the both partitions of the first cluster which needs 2·3 = 6 copy operations. | Java 8 | standard input | [
"greedy"
] | f56597c8c3d17d73b8ede2d81fe5cbe7 | First line contains two integer numbers, m and n (1 ≤ m, n ≤ 105). Second line contains description of the first cluster with m space separated integers, ai (1 ≤ ai ≤ 109). Similarly, third line describes second cluster with n space separated integers, bi (1 ≤ bi ≤ 109). | 1,900 | Print one integer — minimal number of copy operations. | standard output | |
PASSED | 44a3034ad486ccf73e90c39b941b9ae6 | train_001.jsonl | 1407690000 | Piegirl was asked to implement two table join operation for distributed database system, minimizing the network traffic.Suppose she wants to join two tables, A and B. Each of them has certain number of rows which are distributed on different number of partitions. Table A is distributed on the first cluster consisting o... | 256 megabytes | import java.io.FileNotFoundException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.File;
import java.io.Writer;
import java.util.List;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.util.ArrayList;
import jav... | Java | ["2 2\n2 6\n3 100", "2 3\n10 10\n1 1 1"] | 1 second | ["11", "6"] | NoteIn the first example it makes sense to move all the rows to the second partition of the second cluster which is achieved in 2 + 6 + 3 = 11 operationsIn the second example Piegirl can copy each row from B to the both partitions of the first cluster which needs 2·3 = 6 copy operations. | Java 8 | standard input | [
"greedy"
] | f56597c8c3d17d73b8ede2d81fe5cbe7 | First line contains two integer numbers, m and n (1 ≤ m, n ≤ 105). Second line contains description of the first cluster with m space separated integers, ai (1 ≤ ai ≤ 109). Similarly, third line describes second cluster with n space separated integers, bi (1 ≤ bi ≤ 109). | 1,900 | Print one integer — minimal number of copy operations. | standard output | |
PASSED | df9655e438fa3f4c01bfe38def29539e | train_001.jsonl | 1407690000 | Piegirl was asked to implement two table join operation for distributed database system, minimizing the network traffic.Suppose she wants to join two tables, A and B. Each of them has certain number of rows which are distributed on different number of partitions. Table A is distributed on the first cluster consisting o... | 256 megabytes | import java.util.*;
import java.io.*;
public class b {
public static void main(String[] args) throws IOException
{
input.init(System.in);
int n = input.nextInt(), m = input.nextInt();
int[] as = new int[n], bs = new int[m];
for(int i = 0; i<n; i++) as[i] = input.nextInt();
for(int i = 0; i<m; i++) b... | Java | ["2 2\n2 6\n3 100", "2 3\n10 10\n1 1 1"] | 1 second | ["11", "6"] | NoteIn the first example it makes sense to move all the rows to the second partition of the second cluster which is achieved in 2 + 6 + 3 = 11 operationsIn the second example Piegirl can copy each row from B to the both partitions of the first cluster which needs 2·3 = 6 copy operations. | Java 8 | standard input | [
"greedy"
] | f56597c8c3d17d73b8ede2d81fe5cbe7 | First line contains two integer numbers, m and n (1 ≤ m, n ≤ 105). Second line contains description of the first cluster with m space separated integers, ai (1 ≤ ai ≤ 109). Similarly, third line describes second cluster with n space separated integers, bi (1 ≤ bi ≤ 109). | 1,900 | Print one integer — minimal number of copy operations. | standard output | |
PASSED | 1d39a3ddfe8aa410992d80f9e68c90a3 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class D {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x = sc.nextInt();
sc.nextLine();
ArrayList<Integer> s = new ArrayList<Integer>();
for (int i = 0; i < ... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | c7372aa7e9f1c6d4e4eb3fee47b6dd1f | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 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 m = in.nextInt();
int[] a = new int[10000];
Arrays.fill(a,100100);
for(int i = 0; i<n;i++)
a[i+... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 7efb0e9fae7ef96cbddf1d0401f178b7 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.*;
public class C166 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int x = in.nextInt();
int min = Integer.MIN_VALUE;
int max = Integer.MAX_VALUE;
LinkedList<Integer> a = new LinkedList<Integer>... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | a4bf4aa5429d481c5d1e5b111c44cfd5 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception{
new Main().run();
}
private void run() throws Exception{
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int median = input.nextInt();
int l... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 291cba048a51f5bdd375e4e67d1d18ed | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Egor Kuli... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 00e64a50c0a9fe864b8373e8cf2ebba7 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int[] arr = new int[n];
int less = 0;
int bigger = 0;
int equal = 0;
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 0fa36fad71943307865834f662780c13 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class aaatwo {
public static void main(String args[]) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
StringTokenizer tok = new StringTokeni... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 5a25288c540f0359b80f392b894b638d | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
import java.util.Collections;
public class problem166C {
public void run() {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int x = in.nextInt();
int i;
ArrayList<Integer> a = new ArrayList<Integer>();
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | c5c485b83e7e3139d487d2e18dce0b9e | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.*;
import java.util.*;
public class CC {
String s = null;
String[] ss = null;
public void run() throws Exception{
BufferedReader br = null;
File file = new File("input.txt");
if(file.exists()){
br = new BufferedReader(new FileReader("input.txt"));
}
else{
br = new BufferedReader(new... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 3dea7dfecc2dcbf028ce734a141a5c26 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.*;
public class maximus {
public static void main(String [] args){
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int x=in.nextInt();
int array[]=new int[n + 1];
for(int i=1;i<=n;i++)
array[i]=in.nextInt();
Arrays.sort(array);
int max=Integer.MIN_VALUE;
in... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | d00ea634d2972b0d8319451c3f507cdb | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Median2 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int x = scan.nextInt();
int[] array = new int[n];
boolean found = false;
for (int i = 0; ... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 38e2578dd05d81bf0a950f0a9d6da36a | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes |
import java.util.*;
public class Main {
public void doIt(){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x = sc.nextInt();
//入力
ArrayList<Integer> array = new ArrayList<Integer>(n);
for(int i=0; i < n; i++){
array.add(sc.nextInt());
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | fb15b5189306a971e5c253615fb30c26 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | //package codeforces;
import java.util.*;
public class Main {
Scanner scan=new Scanner(System.in);
void run(){
int n=scan.nextInt();
int k=scan.nextInt();
int ans=0;
int pp[]=new int[n*2+1];
for(int i=0;i<n;i++)
pp[i]=scan.nextInt();
Arrays.sort... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 9fb18502fbca7067c53f8905c281ff41 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.*;
public class Main {
void C(){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x = sc.nextInt();
ArrayList<Integer> a = new ArrayList<Integer>();
for(int i=0; i<n; i++){
a.add(sc.nextInt());
}
Collections.sort(a);
int count=0,med=0,size=0;
boolean flag=false;
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 33ea697cdaf437c0e7b5299bf7560b37 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Round113_C {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int[] a = new int[n + 1];
for (int i = 0; i < n; i++)
a[i] = in... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | aad25b2949e5103a348d79a1654dc04c | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.*;
public class C {
Scanner sc = new Scanner(System.in);
void doIt()
{
int n = sc.nextInt(), x = sc.nextInt();
ArrayList<Integer> data = new ArrayList<Integer>();
for(int i = 0; i < n; i++) {
data.add(sc.nextInt());
}
int step = 0;
for(step = 0; ; step++) {
Collections.sort(data);
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 9d8a4d563e5135d7988e2c2e7c885439 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.*;
import java.io.*;
public class a {
public static void main(String[] args) throws IOException
{
//input.init(System.in);
Scanner input = new Scanner(System.in);
int n = input.nextInt(), k = input.nextInt();
int less = 0, eq = 0, greater = 0;
for(int i = 0; i<n; i++)
{
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | af21d793259d92bf7643ddcef58e484e | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Solution {
public static PrintWriter out;
public static StreamTokenizer in;
public static BufferedReader ins;
static int nextInt() throws IOException {
in.nextToken();
return (int)in.nval;
}
public static voi... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 232568682562d6d7fb57f8840b69b4ef | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class C {
private void solve() throws IOException {
int n = nextInt();
int x = nextInt();
int[] a = new int[n];
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 1a064deac1a2d9363274023421fe8164 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
public class B {
public static void main( final String[] args ) throws Exception {
final BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
String[]... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | b9bbff54ec0dbda7439de72ac85ac725 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.Scanner;
public class Prob166C {
public static void main(String[] Args) {
Scanner in = new Scanner(System.in);
int length = in.nextInt();
int required = in.nextInt();
int below = 0;
int equals = 0;
int above = 0;
for (int i = 0; i < length; i++) {
int x = in.nextInt();
if (x < re... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 82a9afa6d23c1fbbfa3dc8c6266ffbf0 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class C113B{
static BufferedReader br;
public static void main(String args[])throws Exception{
br=new BufferedReader(new InputStreamReader(System.in));
int nm[]=toIntArray();
int n=nm[0];
int x=nm[1];
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | b423d00f0f47bef18a14c33c013d42f3 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes |
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class C {
/**
* @param args
*/
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int k = scan.nextInt();
ArrayList<Integer> a = new ArrayList<Integer>(n);
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 2fd6506963d6f5e3b61c46a568ce7521 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args){
Solver.solve();
}
}
class Solver{
public static void solve()
{
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int x = in.nextInt();
int[] p = new int[1111];
for (int i=0;i<n;i++)
{
p[i]... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | a136bc93b0c43b2f2675fabd65e879b9 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int old = n;
int x = in.nextInt();
int less = 0;
int more = 0;
int equal = 0;
for ... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 007d39007c5d4eb9afd05ae1cddd914b | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes |
import java.io.*;
import java.util.*;
public class C113 implements Runnable {
public StringTokenizer st;
public BufferedReader in;
public PrintWriter out;
public static void main(String[] args) {
new Thread(new C113()).start();
}
public void run() {
try {
in = new BufferedReader(new InputStreamReader(S... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 5f31a0ca16a61debccdcffa71898f448 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import static java.util.Arrays.sort;
import java.io.*;
import java.util.*;
public class C {
private static void solve() throws IOException {
int n = nextInt(), x = nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
sort(a);
int less = 0, greater = 0;
for (int i : a) ... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | fc26e08d3331a520beddc53acc5e5d9a | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class CodeforcesRound113Div2 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int med = scan.nextInt();
int[] array = new int[n];
for (int i = 0; i < n; i++)
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 96ad49530f21df676e40b566497112d1 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.*;
public class C{
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int x = s.nextInt();
ArrayList<Integer> arr = new ArrayList<Integer>();
for(int i=0;i<n;i++){
arr.add(s.nextInt());
}
Collections.sort(arr);
int total=0;
while(t... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 2d71207aa00b5a63d6d0309256d7e0b5 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 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.St... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 0213302bf2498bc40dba8b640609b04b | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.Scanner;
public class P166C
{
public static void main(String[] args)
{
Scanner myScanner = new Scanner(System.in);
int n = myScanner.nextInt();
int x = myScanner.nextInt();
int less = 0;
int equal = 0;
int greater = 0;
int cursize = n;
for (int i = 0; i < n; i++)
{
int next... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | ac7302e4f17149a3c596dd19f7737939 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.Scanner;
import java.util.TreeSet;
public class ClassB
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int n = in.nextInt(), x = in.nextInt();
int a = 0;
int b = 0;
for (int i = 0; i < n; ++i)
{
int t = in.nextInt();
if (t < x)
a++;
else if (t... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 8595a9bdf484fcf2f4b08e612509615c | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
//Scanner in = new Scanner(new FileReader("Input"));
PrintWriter out = new PrintWriter(System.out);
Task solver = new Task();
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 5dac9bc8dd5e64f4453d185d06d30323 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class CF_166C {
/**
* @param args
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int x = in.nextInt();
int[] arr = new int[n];
for(int i = 0; i < n; i++) {
arr[i] = in.nextInt();
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | cd9c251f431338b7b88a653692e3ba03 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | //package round113;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
public class C {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni(), x = ni();
int[] a = new int[n];
for(int i ... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 0bccdfa7908a5d17a2371a9af86d36d5 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class C
{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = null;
private void solve() throws IOException
{
int... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 4332c4943e600ed40c5e481ffde06c4e | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.*;
import java.io.*;
public class C{
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int n=in.nextInt(), key = in.nextInt();
int[] a = new int[1001];
for (int i=1;i<=n;i++) a[i]=in.nextInt();
for (int i=1;i<n;i++)
for (int j = i+1;j<=n;j++)
if (a[i]>a[j]... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 4c5a8f780a7d3894afe6ac39d3ed382a | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
impo... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | bd0a4e549f9e42c73dac85f7f021e4e0 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class C
{
String line;
StringTokenizer inputParser;
BufferedReader is;
FileInputStream fstream;
DataInputStream in;
String FInput="";
void openInput(String file)
{
if(file==null)is = new BufferedReader(new InputStreamReader(System... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | f685f9b152892d345c3155b9f5ba6de6 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 64b2aca9ea5790dbc7480267c5a43647 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 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.Collections;
import java.util.Locale;
import java.util.StringTokenizer;
public class C {
private void solve() throws IOExcepti... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 3eabfd23681b5403add3068f17c1b9e7 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main
{
public static void main(String[] args)
{
Input... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | f410ebb487a9f9989d07f07146f48038 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.Arrays;
import java.util.HashSet;
/**
* @author piuspratik (Piyush Das)
*/
public class TaskC {
void run(){
int n = nextInt(), x = nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++) a[i] = nextInt();
Arrays.sort(a);
int start = -1, end = n;
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | cedfa23eef454fe455580a612bc3521a | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.*;
public class Median166C
{
public static void main(String[] args)
{
// Set up scanner
Scanner sc = new Scanner(System.in);
// System.out.println("Enter n");
int n = sc.nextInt();
// System.out.println("Enter x"); // The desired median-add if not ... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | c6014453e167c448202e463245e435f1 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
import static java.lang.Math.*;
public class c113 {
public static void debug(Object... obs) {
System.out.println(Arrays.deepToString(obs));
}
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 988ded201974c83b1aa4b39c08f6d0c9 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 5bc64e68018185fbb82937c4707eb1c4 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | /**
* Created by IntelliJ IDEA.
* Date: 3/16/12
* Time: 6:30 PM
* @author Andrew Porokhin, andrew.porokhin@gmail.com
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class ... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | d05bad794d24ac41cf5919cebf4c86f4 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
int n=scan.nextInt();
int x=scan.nextInt();
int res=0;
... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 99f80cfc02bb6bb29171510822593fd5 | train_002.jsonl | 1332516600 | A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median of an array (2, 6, 1, 2, 3) is the number 2, and a median of array (0, 96, 17, 23) — the number 17.We define an expre... | 256 megabytes | import java.util.*;
import java.io.*;
import java.awt.Point;
import static java.lang.Math.*;
public class P166C {
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int x = in.nextInt();
List<Integer> L = new ArrayLi... | Java | ["3 10\n10 20 30", "3 4\n1 2 3"] | 2 seconds | ["1", "4"] | NoteIn the first sample we can add number 9 to array (10, 20, 30). The resulting array (9, 10, 20, 30) will have a median in position , that is, 10.In the second sample you should add numbers 4, 5, 5, 5. The resulting array has median equal to 4. | Java 6 | standard input | [
"sortings",
"greedy",
"math"
] | 1a73bda2b9c2038d6ddf39918b90da61 | The first input line contains two space-separated integers n and x (1 ≤ n ≤ 500, 1 ≤ x ≤ 105) — the initial array's length and the required median's value. The second line contains n space-separated numbers — the initial array. The elements of the array are integers from 1 to 105. The array elements are not necessarily... | 1,500 | Print the only integer — the minimum number of elements Petya needs to add to the array so that its median equals x. | standard output | |
PASSED | 6d37ef3bdaa2f6babb795a231b609b73 | train_002.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static class Scan {
private byte[] buf=new byte[1024];
private int index;
private InputStream in;
private int total;
public Scan()
{
in=System.in;
}
public int scan()throws IOExcepti... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 80a7174f87e1c9e67744e3c14347e2a8 | train_002.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
int n=Integer.parseInt(bu.readLine());
String s[... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 911c7dbe56f6e60673ea9f7e3e784535 | train_002.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class Solution_1419D2 {
private static final long MODULO = 1_000_000_007L; //prime modulo
public static void main(String[] args) {
try {
Scanner in = new Scanner(new BufferedReader(new InputStreamRe... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | fe84e517bf3aa4dad4ab6a4bd86215e9 | train_002.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args) {
FastScanner fs=new FastScanner();
//int T=fs.nextI... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 2799a550351173d8421656f4b2c563d8 | train_002.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class C {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
int a[] = sc.readArray(n);
int b[] = new int[n];
int k = 0;
Arrays.sort(a... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 3fcd66455bb9c2909a0fc609e290c74c | train_002.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class cf {
private static final int MOD = (int) (1e9 + 7), MOD_FFT = 998244353;
private static final Reader r = new Reader();
private static final PrintWri... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | a8bf2041f8875cc8ea6f4faffc1f9763 | train_002.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | //package hiougyf;
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
public class Solution {
public static void main(String[] args){
Scanner sc =new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++) {
a[i]=sc.nextInt();
}
Arrays.sort(a);
int j=0;
... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | bdf72050395e3471e3691b1e345434ac | train_002.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | //package hiougyf;
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
public class Solution {
public static void main(String[] args){
Scanner sc =new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++) {
a[i]=sc.nextInt();
}
Arrays.sort(a);
int j=0;
... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 962f4ba9e9c687891a212f4d70275dfb | train_002.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes |
import java.util.*;
public class A{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int [n];
for(int i=0;i<n;i++) {
a[i]=sc.nextInt();
}
Arrays.parallelSort(a);
int b[]=new int[n];
... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | b6ea180e2e586463a74ece363f717d7c | train_002.jsonl | 1589707200 | You are given a string $$$s$$$ such that each its character is either 1, 2, or 3. You have to choose the shortest contiguous substring of $$$s$$$ such that it contains each of these three characters at least once.A contiguous substring of string $$$s$$$ is a string that can be obtained from $$$s$$$ by removing some (po... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.math.*;
public class daniel {
public static void main(String args[])throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
OutputStream out=new BufferedOutputStream(System.out);
int t=Integer.parseInt(br.readLine()... | Java | ["7\n123\n12222133333332\n112233\n332211\n12121212\n333333\n31121"] | 2 seconds | ["3\n3\n4\n4\n0\n0\n4"] | NoteConsider the example test:In the first test case, the substring 123 can be used.In the second test case, the substring 213 can be used.In the third test case, the substring 1223 can be used.In the fourth test case, the substring 3221 can be used.In the fifth test case, there is no character 3 in $$$s$$$.In the sixt... | Java 8 | standard input | [
"dp",
"two pointers",
"implementation",
"binary search"
] | 6cb06a02077750327602a1a7eeac770f | The first line contains one integer $$$t$$$ ($$$1 \le t \le 20000$$$) — the number of test cases. Each test case consists of one line containing the string $$$s$$$ ($$$1 \le |s| \le 200000$$$). It is guaranteed that each character of $$$s$$$ is either 1, 2, or 3. The sum of lengths of all strings in all test cases does... | 1,200 | For each test case, print one integer — the length of the shortest contiguous substring of $$$s$$$ containing all three types of characters at least once. If there is no such substring, print $$$0$$$ instead. | standard output | |
PASSED | 455536ac1a99e8bc57cab9d139eec681 | train_002.jsonl | 1589707200 | You are given a string $$$s$$$ such that each its character is either 1, 2, or 3. You have to choose the shortest contiguous substring of $$$s$$$ such that it contains each of these three characters at least once.A contiguous substring of string $$$s$$$ is a string that can be obtained from $$$s$$$ by removing some (po... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int tst = Integer.parseInt(br.readLine());
ArrayList<pair> lst = new ArrayList<>();
StringB... | Java | ["7\n123\n12222133333332\n112233\n332211\n12121212\n333333\n31121"] | 2 seconds | ["3\n3\n4\n4\n0\n0\n4"] | NoteConsider the example test:In the first test case, the substring 123 can be used.In the second test case, the substring 213 can be used.In the third test case, the substring 1223 can be used.In the fourth test case, the substring 3221 can be used.In the fifth test case, there is no character 3 in $$$s$$$.In the sixt... | Java 8 | standard input | [
"dp",
"two pointers",
"implementation",
"binary search"
] | 6cb06a02077750327602a1a7eeac770f | The first line contains one integer $$$t$$$ ($$$1 \le t \le 20000$$$) — the number of test cases. Each test case consists of one line containing the string $$$s$$$ ($$$1 \le |s| \le 200000$$$). It is guaranteed that each character of $$$s$$$ is either 1, 2, or 3. The sum of lengths of all strings in all test cases does... | 1,200 | For each test case, print one integer — the length of the shortest contiguous substring of $$$s$$$ containing all three types of characters at least once. If there is no such substring, print $$$0$$$ instead. | standard output | |
PASSED | ff0d274d1b9a55b3fa38356efdba7ada | train_002.jsonl | 1589707200 | You are given a string $$$s$$$ such that each its character is either 1, 2, or 3. You have to choose the shortest contiguous substring of $$$s$$$ such that it contains each of these three characters at least once.A contiguous substring of string $$$s$$$ is a string that can be obtained from $$$s$$$ by removing some (po... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Solution
{
static class Pair<A,B>
{
A parent;
B rank;
Pair(A parent,B rank)
{
this.rank=rank;
this.parent=parent;
}
}
static class Node{
int left;... | Java | ["7\n123\n12222133333332\n112233\n332211\n12121212\n333333\n31121"] | 2 seconds | ["3\n3\n4\n4\n0\n0\n4"] | NoteConsider the example test:In the first test case, the substring 123 can be used.In the second test case, the substring 213 can be used.In the third test case, the substring 1223 can be used.In the fourth test case, the substring 3221 can be used.In the fifth test case, there is no character 3 in $$$s$$$.In the sixt... | Java 8 | standard input | [
"dp",
"two pointers",
"implementation",
"binary search"
] | 6cb06a02077750327602a1a7eeac770f | The first line contains one integer $$$t$$$ ($$$1 \le t \le 20000$$$) — the number of test cases. Each test case consists of one line containing the string $$$s$$$ ($$$1 \le |s| \le 200000$$$). It is guaranteed that each character of $$$s$$$ is either 1, 2, or 3. The sum of lengths of all strings in all test cases does... | 1,200 | For each test case, print one integer — the length of the shortest contiguous substring of $$$s$$$ containing all three types of characters at least once. If there is no such substring, print $$$0$$$ instead. | standard output | |
PASSED | 987d6c685738d0f2511df94b70752f7c | train_002.jsonl | 1589707200 | You are given a string $$$s$$$ such that each its character is either 1, 2, or 3. You have to choose the shortest contiguous substring of $$$s$$$ such that it contains each of these three characters at least once.A contiguous substring of string $$$s$$$ is a string that can be obtained from $$$s$$$ by removing some (po... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;
public class TernaryString
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
int t = in.nextInt();
for (int i = 0; ... | Java | ["7\n123\n12222133333332\n112233\n332211\n12121212\n333333\n31121"] | 2 seconds | ["3\n3\n4\n4\n0\n0\n4"] | NoteConsider the example test:In the first test case, the substring 123 can be used.In the second test case, the substring 213 can be used.In the third test case, the substring 1223 can be used.In the fourth test case, the substring 3221 can be used.In the fifth test case, there is no character 3 in $$$s$$$.In the sixt... | Java 8 | standard input | [
"dp",
"two pointers",
"implementation",
"binary search"
] | 6cb06a02077750327602a1a7eeac770f | The first line contains one integer $$$t$$$ ($$$1 \le t \le 20000$$$) — the number of test cases. Each test case consists of one line containing the string $$$s$$$ ($$$1 \le |s| \le 200000$$$). It is guaranteed that each character of $$$s$$$ is either 1, 2, or 3. The sum of lengths of all strings in all test cases does... | 1,200 | For each test case, print one integer — the length of the shortest contiguous substring of $$$s$$$ containing all three types of characters at least once. If there is no such substring, print $$$0$$$ instead. | standard output | |
PASSED | 998e394c7c41bbafd7fe9ecc12868679 | train_002.jsonl | 1443430800 | Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp... | 256 megabytes | import java.util.Scanner;
public class billboard {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a1 = sc.nextInt();
int a2 = sc.nextInt();
if (a1>a2) {
int d = a1;
a1 = a2;
a2 = d;
}
int b1 = sc.nextInt();
int b2 = sc.nextInt();
if (b1>b2) {
int e = b1;
... | Java | ["5 1 2 5 5 2", "4 4 2 6 4 2"] | 1 second | ["5\nAAAAA\nBBBBB\nBBBBB\nCCCCC\nCCCCC", "6\nBBBBBB\nBBBBBB\nAAAACC\nAAAACC\nAAAACC\nAAAACC"] | null | Java 7 | standard input | [
"geometry",
"constructive algorithms",
"bitmasks",
"math",
"implementation",
"brute force"
] | 2befe5da2df57d23934601cbe4d4f151 | The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively. | 1,700 | If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C"... | standard output | |
PASSED | 1c12a1701220557c6becc9285b25755c | train_002.jsonl | 1443430800 | Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp... | 256 megabytes | import java.util.*;
public class D581 {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int[] xs = new int[3], ys = new int[3];
for(int i = 0; i<3; i++)
{
xs[i] = input.nextInt();
ys[i] = input.nextInt();
if(xs[i] > ys[i])
{
int temp = xs[i];
xs[i] = ys[i];
ys[i] = ... | Java | ["5 1 2 5 5 2", "4 4 2 6 4 2"] | 1 second | ["5\nAAAAA\nBBBBB\nBBBBB\nCCCCC\nCCCCC", "6\nBBBBBB\nBBBBBB\nAAAACC\nAAAACC\nAAAACC\nAAAACC"] | null | Java 7 | standard input | [
"geometry",
"constructive algorithms",
"bitmasks",
"math",
"implementation",
"brute force"
] | 2befe5da2df57d23934601cbe4d4f151 | The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively. | 1,700 | If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C"... | standard output | |
PASSED | e8ae0898ffd31d7106f4879e3a1fda37 | train_002.jsonl | 1443430800 | Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public clas... | Java | ["5 1 2 5 5 2", "4 4 2 6 4 2"] | 1 second | ["5\nAAAAA\nBBBBB\nBBBBB\nCCCCC\nCCCCC", "6\nBBBBBB\nBBBBBB\nAAAACC\nAAAACC\nAAAACC\nAAAACC"] | null | Java 7 | standard input | [
"geometry",
"constructive algorithms",
"bitmasks",
"math",
"implementation",
"brute force"
] | 2befe5da2df57d23934601cbe4d4f151 | The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively. | 1,700 | If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C"... | standard output | |
PASSED | 136de237c2ab9b3cf590ba1b1ba27184 | train_002.jsonl | 1443430800 | Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class Codeforces {
StringTokenizer tok;
B... | Java | ["5 1 2 5 5 2", "4 4 2 6 4 2"] | 1 second | ["5\nAAAAA\nBBBBB\nBBBBB\nCCCCC\nCCCCC", "6\nBBBBBB\nBBBBBB\nAAAACC\nAAAACC\nAAAACC\nAAAACC"] | null | Java 7 | standard input | [
"geometry",
"constructive algorithms",
"bitmasks",
"math",
"implementation",
"brute force"
] | 2befe5da2df57d23934601cbe4d4f151 | The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively. | 1,700 | If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C"... | standard output | |
PASSED | 0ffeca69e334eb6ee2aee7ef6a030b6b | train_002.jsonl | 1443430800 | Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp... | 256 megabytes | import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URL;
import java.util.*;
/**
* Created by smalex on 28/09/15.
*/
public class P581D {
private static class Logo implements Comparable<Logo> {
private final int x;
private f... | Java | ["5 1 2 5 5 2", "4 4 2 6 4 2"] | 1 second | ["5\nAAAAA\nBBBBB\nBBBBB\nCCCCC\nCCCCC", "6\nBBBBBB\nBBBBBB\nAAAACC\nAAAACC\nAAAACC\nAAAACC"] | null | Java 7 | standard input | [
"geometry",
"constructive algorithms",
"bitmasks",
"math",
"implementation",
"brute force"
] | 2befe5da2df57d23934601cbe4d4f151 | The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively. | 1,700 | If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C"... | standard output | |
PASSED | 768af1ce9190a4f6b4ae628f12200c24 | train_002.jsonl | 1443430800 | Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp... | 256 megabytes | import java.util.*;
import java.lang.Math;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x1 = sc.nextInt(),
y1 = sc.nextInt(),
x2 = sc.nextInt(),
y2 = sc.nextInt(),
x3 = sc.nex... | Java | ["5 1 2 5 5 2", "4 4 2 6 4 2"] | 1 second | ["5\nAAAAA\nBBBBB\nBBBBB\nCCCCC\nCCCCC", "6\nBBBBBB\nBBBBBB\nAAAACC\nAAAACC\nAAAACC\nAAAACC"] | null | Java 7 | standard input | [
"geometry",
"constructive algorithms",
"bitmasks",
"math",
"implementation",
"brute force"
] | 2befe5da2df57d23934601cbe4d4f151 | The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively. | 1,700 | If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C"... | standard output | |
PASSED | c6fe7d832e8a2718e206a1537c8a6a1b | train_002.jsonl | 1443430800 | Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
public class P7 {
private static char[][] answer;
private static final int X1 = 0;
private static final int Y1 = 1;
private static final int X2 = 2;
privat... | Java | ["5 1 2 5 5 2", "4 4 2 6 4 2"] | 1 second | ["5\nAAAAA\nBBBBB\nBBBBB\nCCCCC\nCCCCC", "6\nBBBBBB\nBBBBBB\nAAAACC\nAAAACC\nAAAACC\nAAAACC"] | null | Java 7 | standard input | [
"geometry",
"constructive algorithms",
"bitmasks",
"math",
"implementation",
"brute force"
] | 2befe5da2df57d23934601cbe4d4f151 | The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively. | 1,700 | If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C"... | standard output | |
PASSED | ef7abef8fa1b1dd61adb6740114a52e2 | train_002.jsonl | 1443430800 | Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp... | 256 megabytes | import java.io.*;
import java.util.*;
public class D
{
FastScanner in;
PrintWriter out;
int i = 0, j = 0;
char[][] billboard;
int nextY, nextX;
void solve() {
/**************START**************/
int x1 = in.nextInt();
int big = x1;
int y1 = in.nextInt();
big = Math.max(big, y1);
int x2 = in.nextI... | Java | ["5 1 2 5 5 2", "4 4 2 6 4 2"] | 1 second | ["5\nAAAAA\nBBBBB\nBBBBB\nCCCCC\nCCCCC", "6\nBBBBBB\nBBBBBB\nAAAACC\nAAAACC\nAAAACC\nAAAACC"] | null | Java 7 | standard input | [
"geometry",
"constructive algorithms",
"bitmasks",
"math",
"implementation",
"brute force"
] | 2befe5da2df57d23934601cbe4d4f151 | The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively. | 1,700 | If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C"... | standard output | |
PASSED | bd796396d1daff6cdf3ee4def6025513 | train_002.jsonl | 1443430800 | Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp... | 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.Bit... | Java | ["5 1 2 5 5 2", "4 4 2 6 4 2"] | 1 second | ["5\nAAAAA\nBBBBB\nBBBBB\nCCCCC\nCCCCC", "6\nBBBBBB\nBBBBBB\nAAAACC\nAAAACC\nAAAACC\nAAAACC"] | null | Java 7 | standard input | [
"geometry",
"constructive algorithms",
"bitmasks",
"math",
"implementation",
"brute force"
] | 2befe5da2df57d23934601cbe4d4f151 | The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively. | 1,700 | If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C"... | standard output | |
PASSED | 60d38eb949493f4d81b586573ed7dece | train_002.jsonl | 1443430800 | Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class P581D {
public static void print_n(int count, char c) {
for(int i = 0; i < count; i++)
System.out.print(c);
}
public static void print_n_lines(int dim, char c, int n) {
for (int i = 0; i < n; i++... | Java | ["5 1 2 5 5 2", "4 4 2 6 4 2"] | 1 second | ["5\nAAAAA\nBBBBB\nBBBBB\nCCCCC\nCCCCC", "6\nBBBBBB\nBBBBBB\nAAAACC\nAAAACC\nAAAACC\nAAAACC"] | null | Java 7 | standard input | [
"geometry",
"constructive algorithms",
"bitmasks",
"math",
"implementation",
"brute force"
] | 2befe5da2df57d23934601cbe4d4f151 | The first line of the input contains six positive integers x1, y1, x2, y2, x3, y3 (1 ≤ x1, y1, x2, y2, x3, y3 ≤ 100), where xi and yi determine the length and width of the logo of the i-th company respectively. | 1,700 | If it is impossible to place all the three logos on a square shield, print a single integer "-1" (without the quotes). If it is possible, print in the first line the length of a side of square n, where you can place all the three logos. Each of the next n lines should contain n uppercase English letters "A", "B" or "C"... | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.