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
2d4a91361b7f9a000e81681764cf672c
train_000.jsonl
1557671700
Let $$$c$$$ be some positive integer. Let's call an array $$$a_1, a_2, \ldots, a_n$$$ of positive integers $$$c$$$-array, if for all $$$i$$$ condition $$$1 \leq a_i \leq c$$$ is satisfied. Let's call $$$c$$$-array $$$b_1, b_2, \ldots, b_k$$$ a subarray of $$$c$$$-array $$$a_1, a_2, \ldots, a_n$$$, if there exists such ...
256 megabytes
import java.io.*; import java.util.*; public class cf559F { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; static final int P = 998244353; static final int DBL_P = 2 * P; static final long Q = 4L * P * P; static int pow(int a, int b) { int ret = 1; for (; b > 0; b >>= 1) { if ((...
Java
["4 1\n1 1 1 1", "3 3\n1 2 3", "5 2\n1 2 1 2 1"]
6 seconds
["0 4 6 4 1", "6 1 0 0", "10 17 4 0 0 0"]
NoteIn the first example, it's easy to see that the density of array will always be equal to its length. There exists $$$4$$$ sequences with one index, $$$6$$$ with two indices, $$$4$$$ with three and $$$1$$$ with four.In the second example, the only sequence of indices, such that the array will have non-zero density i...
Java 8
standard input
[ "dp", "math" ]
95c277d67c04fc644989c3112c2b5ae7
The first line contains two integers $$$n$$$ and $$$c$$$, separated by spaces ($$$1 \leq n, c \leq 3\,000$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$, separated by spaces ($$$1 \leq a_i \leq c$$$).
3,500
Print $$$n + 1$$$ numbers $$$s_0, s_1, \ldots, s_n$$$. $$$s_p$$$ should be equal to the number of sequences of indices $$$1 \leq i_1 < i_2 < \ldots < i_k \leq n$$$ for all $$$1 \leq k \leq n$$$ by modulo $$$998\,244\,353$$$, such that the density of array $$$a_{i_1}, a_{i_2}, \ldots, a_{i_k}$$$ is equal to $$$...
standard output
PASSED
5e55a3bb871bfdc136419cd293d6d5cf
train_000.jsonl
1557671700
Let $$$c$$$ be some positive integer. Let's call an array $$$a_1, a_2, \ldots, a_n$$$ of positive integers $$$c$$$-array, if for all $$$i$$$ condition $$$1 \leq a_i \leq c$$$ is satisfied. Let's call $$$c$$$-array $$$b_1, b_2, \ldots, b_k$$$ a subarray of $$$c$$$-array $$$a_1, a_2, \ldots, a_n$$$, if there exists such ...
256 megabytes
import java.io.*; import java.util.*; public class cf559F { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; static final int P = 998244353; static final int DBL_P = 2 * P; static final long Q = 4L * P * P; static int pow(int a, int b) { int ret = 1; for (; b > 0; b >>= 1) { if ((...
Java
["4 1\n1 1 1 1", "3 3\n1 2 3", "5 2\n1 2 1 2 1"]
6 seconds
["0 4 6 4 1", "6 1 0 0", "10 17 4 0 0 0"]
NoteIn the first example, it's easy to see that the density of array will always be equal to its length. There exists $$$4$$$ sequences with one index, $$$6$$$ with two indices, $$$4$$$ with three and $$$1$$$ with four.In the second example, the only sequence of indices, such that the array will have non-zero density i...
Java 8
standard input
[ "dp", "math" ]
95c277d67c04fc644989c3112c2b5ae7
The first line contains two integers $$$n$$$ and $$$c$$$, separated by spaces ($$$1 \leq n, c \leq 3\,000$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$, separated by spaces ($$$1 \leq a_i \leq c$$$).
3,500
Print $$$n + 1$$$ numbers $$$s_0, s_1, \ldots, s_n$$$. $$$s_p$$$ should be equal to the number of sequences of indices $$$1 \leq i_1 < i_2 < \ldots < i_k \leq n$$$ for all $$$1 \leq k \leq n$$$ by modulo $$$998\,244\,353$$$, such that the density of array $$$a_{i_1}, a_{i_2}, \ldots, a_{i_k}$$$ is equal to $$$...
standard output
PASSED
a9964caafd0d5b8a88b3cb6852f9136e
train_000.jsonl
1557671700
Let $$$c$$$ be some positive integer. Let's call an array $$$a_1, a_2, \ldots, a_n$$$ of positive integers $$$c$$$-array, if for all $$$i$$$ condition $$$1 \leq a_i \leq c$$$ is satisfied. Let's call $$$c$$$-array $$$b_1, b_2, \ldots, b_k$$$ a subarray of $$$c$$$-array $$$a_1, a_2, \ldots, a_n$$$, if there exists such ...
256 megabytes
import java.io.*; import java.util.*; public class cf559F { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; static final int P = 998244353; static final int DBL_P = 2 * P; static final long Q = 4L * P * P; static int pow(int a, int b) { int ret = 1; for (; b > 0; b >>= 1) { if ((...
Java
["4 1\n1 1 1 1", "3 3\n1 2 3", "5 2\n1 2 1 2 1"]
6 seconds
["0 4 6 4 1", "6 1 0 0", "10 17 4 0 0 0"]
NoteIn the first example, it's easy to see that the density of array will always be equal to its length. There exists $$$4$$$ sequences with one index, $$$6$$$ with two indices, $$$4$$$ with three and $$$1$$$ with four.In the second example, the only sequence of indices, such that the array will have non-zero density i...
Java 8
standard input
[ "dp", "math" ]
95c277d67c04fc644989c3112c2b5ae7
The first line contains two integers $$$n$$$ and $$$c$$$, separated by spaces ($$$1 \leq n, c \leq 3\,000$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$, separated by spaces ($$$1 \leq a_i \leq c$$$).
3,500
Print $$$n + 1$$$ numbers $$$s_0, s_1, \ldots, s_n$$$. $$$s_p$$$ should be equal to the number of sequences of indices $$$1 \leq i_1 < i_2 < \ldots < i_k \leq n$$$ for all $$$1 \leq k \leq n$$$ by modulo $$$998\,244\,353$$$, such that the density of array $$$a_{i_1}, a_{i_2}, \ldots, a_{i_k}$$$ is equal to $$$...
standard output
PASSED
60cc1d5b01feec9f7f87823ab349e129
train_000.jsonl
1557671700
Let $$$c$$$ be some positive integer. Let's call an array $$$a_1, a_2, \ldots, a_n$$$ of positive integers $$$c$$$-array, if for all $$$i$$$ condition $$$1 \leq a_i \leq c$$$ is satisfied. Let's call $$$c$$$-array $$$b_1, b_2, \ldots, b_k$$$ a subarray of $$$c$$$-array $$$a_1, a_2, \ldots, a_n$$$, if there exists such ...
256 megabytes
import java.io.*; import java.util.*; public class cf559F { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; static final int P = 998244353; static final int DBL_P = 2 * P; static final long Q = 4L * P * P; static int pow(int a, int b) { int ret = 1; for (; b > 0; b >>= 1) { if ((...
Java
["4 1\n1 1 1 1", "3 3\n1 2 3", "5 2\n1 2 1 2 1"]
6 seconds
["0 4 6 4 1", "6 1 0 0", "10 17 4 0 0 0"]
NoteIn the first example, it's easy to see that the density of array will always be equal to its length. There exists $$$4$$$ sequences with one index, $$$6$$$ with two indices, $$$4$$$ with three and $$$1$$$ with four.In the second example, the only sequence of indices, such that the array will have non-zero density i...
Java 8
standard input
[ "dp", "math" ]
95c277d67c04fc644989c3112c2b5ae7
The first line contains two integers $$$n$$$ and $$$c$$$, separated by spaces ($$$1 \leq n, c \leq 3\,000$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$, separated by spaces ($$$1 \leq a_i \leq c$$$).
3,500
Print $$$n + 1$$$ numbers $$$s_0, s_1, \ldots, s_n$$$. $$$s_p$$$ should be equal to the number of sequences of indices $$$1 \leq i_1 < i_2 < \ldots < i_k \leq n$$$ for all $$$1 \leq k \leq n$$$ by modulo $$$998\,244\,353$$$, such that the density of array $$$a_{i_1}, a_{i_2}, \ldots, a_{i_k}$$$ is equal to $$$...
standard output
PASSED
349a2fc777ee14c46f4a78f3d51ebb14
train_000.jsonl
1590327300
Find the minimum area of a square land on which you can place two identical rectangular $$$a \times b$$$ houses. The sides of the houses should be parallel to the sides of the desired square land.Formally, You are given two identical rectangles with side lengths $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 100$$$) — positi...
256 megabytes
import java.util.*; import java.io.*; public class D { public static void main(String[] args) { FastReader in = new FastReader(); int t = in.nextInt(); while (t-- > 0) { int a = in.nextInt(); int b = in.nextInt(); int min = Math.min(a, b); in...
Java
["8\n3 2\n4 2\n1 1\n3 1\n4 7\n1 3\n7 4\n100 100"]
2 seconds
["16\n16\n4\n9\n64\n9\n64\n40000"]
NoteBelow are the answers for the first two test cases:
Java 8
standard input
[ "greedy", "math" ]
3bb093fb17d6b76ae340fab44b08fcb8
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10\,000$$$) —the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is a line containing two integers $$$a$$$, $$$b$$$ ($$$1 \le a, b \le 100$$$) — side lengths of the rectangles.
800
Print $$$t$$$ answers to the test cases. Each answer must be a single integer — minimal area of square land, that contains two rectangles with dimensions $$$a \times b$$$.
standard output
PASSED
ec8bb7fb976b878bd05a309e656b9142
train_000.jsonl
1590327300
Find the minimum area of a square land on which you can place two identical rectangular $$$a \times b$$$ houses. The sides of the houses should be parallel to the sides of the desired square land.Formally, You are given two identical rectangles with side lengths $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 100$$$) — positi...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class CodeChef { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); int testcases = scan.nextInt(); for(int m=0; m<testcases; m++) { int a = scan.nextInt(); int b = scan.n...
Java
["8\n3 2\n4 2\n1 1\n3 1\n4 7\n1 3\n7 4\n100 100"]
2 seconds
["16\n16\n4\n9\n64\n9\n64\n40000"]
NoteBelow are the answers for the first two test cases:
Java 8
standard input
[ "greedy", "math" ]
3bb093fb17d6b76ae340fab44b08fcb8
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10\,000$$$) —the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is a line containing two integers $$$a$$$, $$$b$$$ ($$$1 \le a, b \le 100$$$) — side lengths of the rectangles.
800
Print $$$t$$$ answers to the test cases. Each answer must be a single integer — minimal area of square land, that contains two rectangles with dimensions $$$a \times b$$$.
standard output
PASSED
f78405af1cdf1f70527f4dbea6e5fd99
train_000.jsonl
1590327300
Find the minimum area of a square land on which you can place two identical rectangular $$$a \times b$$$ houses. The sides of the houses should be parallel to the sides of the desired square land.Formally, You are given two identical rectangles with side lengths $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 100$$$) — positi...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class MinimalSquare { public static void main(String[] args) { // TODO Auto-generated method stub // Problem https://codeforces.com/problemset/problem/1360/A // For more solutio...
Java
["8\n3 2\n4 2\n1 1\n3 1\n4 7\n1 3\n7 4\n100 100"]
2 seconds
["16\n16\n4\n9\n64\n9\n64\n40000"]
NoteBelow are the answers for the first two test cases:
Java 8
standard input
[ "greedy", "math" ]
3bb093fb17d6b76ae340fab44b08fcb8
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10\,000$$$) —the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is a line containing two integers $$$a$$$, $$$b$$$ ($$$1 \le a, b \le 100$$$) — side lengths of the rectangles.
800
Print $$$t$$$ answers to the test cases. Each answer must be a single integer — minimal area of square land, that contains two rectangles with dimensions $$$a \times b$$$.
standard output
PASSED
fdb6e1ed418c5de466079d82bde479a7
train_000.jsonl
1590327300
Find the minimum area of a square land on which you can place two identical rectangular $$$a \times b$$$ houses. The sides of the houses should be parallel to the sides of the desired square land.Formally, You are given two identical rectangles with side lengths $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 100$$$) — positi...
256 megabytes
//package Div3_644; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = n...
Java
["8\n3 2\n4 2\n1 1\n3 1\n4 7\n1 3\n7 4\n100 100"]
2 seconds
["16\n16\n4\n9\n64\n9\n64\n40000"]
NoteBelow are the answers for the first two test cases:
Java 8
standard input
[ "greedy", "math" ]
3bb093fb17d6b76ae340fab44b08fcb8
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10\,000$$$) —the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is a line containing two integers $$$a$$$, $$$b$$$ ($$$1 \le a, b \le 100$$$) — side lengths of the rectangles.
800
Print $$$t$$$ answers to the test cases. Each answer must be a single integer — minimal area of square land, that contains two rectangles with dimensions $$$a \times b$$$.
standard output
PASSED
eafbf4cc5daf04ae7755b964c6ceff3a
train_000.jsonl
1590327300
Find the minimum area of a square land on which you can place two identical rectangular $$$a \times b$$$ houses. The sides of the houses should be parallel to the sides of the desired square land.Formally, You are given two identical rectangles with side lengths $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 100$$$) — positi...
256 megabytes
import java.util.*; public class miniMalSquare { public static void main(String args[]) { Scanner in = new Scanner(System.in); int tt = in.nextInt(); while(tt>0) { int n1 = in.nextInt(); int n2 = in.nextInt(); if(n1<n2) { if...
Java
["8\n3 2\n4 2\n1 1\n3 1\n4 7\n1 3\n7 4\n100 100"]
2 seconds
["16\n16\n4\n9\n64\n9\n64\n40000"]
NoteBelow are the answers for the first two test cases:
Java 8
standard input
[ "greedy", "math" ]
3bb093fb17d6b76ae340fab44b08fcb8
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10\,000$$$) —the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is a line containing two integers $$$a$$$, $$$b$$$ ($$$1 \le a, b \le 100$$$) — side lengths of the rectangles.
800
Print $$$t$$$ answers to the test cases. Each answer must be a single integer — minimal area of square land, that contains two rectangles with dimensions $$$a \times b$$$.
standard output
PASSED
1e297d3d4e5d88261b5dd0c254e48699
train_000.jsonl
1590327300
Find the minimum area of a square land on which you can place two identical rectangular $$$a \times b$$$ houses. The sides of the houses should be parallel to the sides of the desired square land.Formally, You are given two identical rectangles with side lengths $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 100$$$) — positi...
256 megabytes
import java.util.*; import java.lang.Math; public class codeforce{ public static void main(String args[]){ Scanner sj = new Scanner(System.in); int t = sj.nextInt(); while(t-->0){ int a = sj.nextInt(); int b = sj.nextInt(); int ans = Math.min(Math.max(2*a, b), Math.max(a, 2*b)); System.out...
Java
["8\n3 2\n4 2\n1 1\n3 1\n4 7\n1 3\n7 4\n100 100"]
2 seconds
["16\n16\n4\n9\n64\n9\n64\n40000"]
NoteBelow are the answers for the first two test cases:
Java 8
standard input
[ "greedy", "math" ]
3bb093fb17d6b76ae340fab44b08fcb8
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10\,000$$$) —the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is a line containing two integers $$$a$$$, $$$b$$$ ($$$1 \le a, b \le 100$$$) — side lengths of the rectangles.
800
Print $$$t$$$ answers to the test cases. Each answer must be a single integer — minimal area of square land, that contains two rectangles with dimensions $$$a \times b$$$.
standard output
PASSED
fe69de1e864ad0b26a832d6b3f541507
train_000.jsonl
1590327300
Find the minimum area of a square land on which you can place two identical rectangular $$$a \times b$$$ houses. The sides of the houses should be parallel to the sides of the desired square land.Formally, You are given two identical rectangles with side lengths $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 100$$$) — positi...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); s.nextLine(); int[] ans = new int[t]; for (int i = 0; i < t; i++) { int a = s.nextInt(); int b = s.nextInt(); int min = Math.min(a, b); ...
Java
["8\n3 2\n4 2\n1 1\n3 1\n4 7\n1 3\n7 4\n100 100"]
2 seconds
["16\n16\n4\n9\n64\n9\n64\n40000"]
NoteBelow are the answers for the first two test cases:
Java 8
standard input
[ "greedy", "math" ]
3bb093fb17d6b76ae340fab44b08fcb8
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10\,000$$$) —the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is a line containing two integers $$$a$$$, $$$b$$$ ($$$1 \le a, b \le 100$$$) — side lengths of the rectangles.
800
Print $$$t$$$ answers to the test cases. Each answer must be a single integer — minimal area of square land, that contains two rectangles with dimensions $$$a \times b$$$.
standard output
PASSED
d1757de6e76a4391a8862d0ff6716088
train_000.jsonl
1590327300
Find the minimum area of a square land on which you can place two identical rectangular $$$a \times b$$$ houses. The sides of the houses should be parallel to the sides of the desired square land.Formally, You are given two identical rectangles with side lengths $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 100$$$) — positi...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); s.nextLine(); int[] ans = new int[t]; for (int i = 0; i < t; i++) { int a = s.nextInt(); int b = s.nextInt(); if (a < b) { a = a * ...
Java
["8\n3 2\n4 2\n1 1\n3 1\n4 7\n1 3\n7 4\n100 100"]
2 seconds
["16\n16\n4\n9\n64\n9\n64\n40000"]
NoteBelow are the answers for the first two test cases:
Java 8
standard input
[ "greedy", "math" ]
3bb093fb17d6b76ae340fab44b08fcb8
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10\,000$$$) —the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is a line containing two integers $$$a$$$, $$$b$$$ ($$$1 \le a, b \le 100$$$) — side lengths of the rectangles.
800
Print $$$t$$$ answers to the test cases. Each answer must be a single integer — minimal area of square land, that contains two rectangles with dimensions $$$a \times b$$$.
standard output
PASSED
d7a49f0a1c9a4937518f6fdfeb804a11
train_000.jsonl
1590327300
Find the minimum area of a square land on which you can place two identical rectangular $$$a \times b$$$ houses. The sides of the houses should be parallel to the sides of the desired square land.Formally, You are given two identical rectangles with side lengths $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le 100$$$) — positi...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while(t>0) { t--; int a,b; a=sc.nextInt(); b=sc.nextInt(); int x = Math.min(a,b); ...
Java
["8\n3 2\n4 2\n1 1\n3 1\n4 7\n1 3\n7 4\n100 100"]
2 seconds
["16\n16\n4\n9\n64\n9\n64\n40000"]
NoteBelow are the answers for the first two test cases:
Java 8
standard input
[ "greedy", "math" ]
3bb093fb17d6b76ae340fab44b08fcb8
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10\,000$$$) —the number of test cases in the input. Then $$$t$$$ test cases follow. Each test case is a line containing two integers $$$a$$$, $$$b$$$ ($$$1 \le a, b \le 100$$$) — side lengths of the rectangles.
800
Print $$$t$$$ answers to the test cases. Each answer must be a single integer — minimal area of square land, that contains two rectangles with dimensions $$$a \times b$$$.
standard output
PASSED
10e1db0ebbafb0ac9a2cad01fe4ba6f1
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner snr=new Scanner(System.in); int n=snr.nextInt(); int[] a=new int[n]; for(int i=0;i<n;i++){ a[i]=snr.nextInt(); } int sol=0; Arrays.sort...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
9b190453a7c57b0baf631ed34786fa6e
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.Scanner; public class RENAMETHISBITCH { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { int n = sc.nextInt(); int max = sc.nextInt(); int sum = 0; for (int i = 1; i < n; i++) { int a = sc.nextInt(); if (max < a) { su...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
eb54eaf22f13f0df8698ac51149e1870
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.Scanner; public class P_758A { public static final String NAME = "Holiday Of Equality"; public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { int n = sc.nextInt(); int max = sc.nextInt(); int welfare = 0; for (int i = 1; i < n; i++) { ...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
6906558b8e058cc565553007d8bf75c6
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); OutputStreamWriter ow = new OutputStreamWriter(System.out); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int c,t,sd=0; c=sc.next...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
418f6c05222e073a4d1bbac15de54a8a
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); OutputStreamWriter ow = new OutputStreamWriter(System.out); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int c,t,sd=0; c=sc.next...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
d2f91c40f73b756ded48dfd25b805c44
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); OutputStreamWriter ow = new OutputStreamWriter(System.out); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int c,t,sd=0; c=sc.next...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
98919f1030913378bf999f3d8ee6181a
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); OutputStreamWriter ow = new OutputStreamWriter(System.out); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int c,t,sd=0; c=sc.next...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
a43f15637e33383540fc3d8abe1a074a
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); OutputStreamWriter ow = new OutputStreamWriter(System.out); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int c,t,sd=0; c=sc.next...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
98634bd92c596b8b368fa24f63c72691
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); OutputStreamWriter ow = new OutputStreamWriter(System.out); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int c,t,sd=0; c=sc.next...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
f32a3f5fd042227adb9f013aa59d2994
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); int c,t,sd=0; c=sc.nextInt(); int b[]=new int[c]; for(int i=0; i<c; i++)...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
6ae3c6f47ca5f2efc28698222373057b
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.io.*; import java.util.*; import java.util.Arrays; import java.util.Collections; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int sum=0,i,max; int[] a = new int[100]; ...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
bd10305eaad5f14a45e576ab8d59cfad
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; public class _p000758A { static public void main(final String[] args) throws jav...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
76980cc0db6941cc7a17231aabaccd69
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.stream.Collectors; public class p000758A { static public void main(String[] args) throw...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
9c90c4129fe775870be2e1ec6e3104ce
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Arrays; import java.util.Scanner; /** * * @author ittraining */ public class Main { /** * @param args t...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
a3efac97656abe09f2fc7a65f9e33b04
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ public static void main(String[] args){ Scanner s = new Scanner(System.in); int n = s.nextInt(); long max = 0; long a[] = new long[(int)n]; for(int i=0; i<n; i++){ a[i] = s.nextLong(); ...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
429442a50afca8a6be9124759b673b93
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.text.*; public class Main{ public static void main(String [] args){ //try{ //File fin = new File("input.txt"); //File fout = new File("output.txt"); Scanner in = new Scanner(System.in); //PrintWriter pw = ne...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
bd6375f0aaa2c77e4cad903d6077bd04
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.Scanner; public class Holiday { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int[] arr=new int[n]; for(int i=0;i<n;i++){ arr[i]=Integer.parseInt(s.next()); } int max=arr[0]; for(in...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
7f9274492875adae705f0c9a8657d611
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.Scanner; public class Holiday { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int[] arr=new int[n]; for(int i=0;i<n;i++){ arr[i]=Integer.parseInt(s.next()); } int max=arr[0]; for(in...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
a067f16923dc3d07303aaaa48c8e6834
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.io.*; import java.lang.ref.WeakReference; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; public class Main { private static int[][] direct = {{0, 1}, {1, 0}, {-1, 0}, {0, -1}}; private static AWriter writer = new AWriter(System.out); private static AReader reade...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
c1569eb6416586520c085408de69aa4e
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
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(); if( n == 1) System.out.println("0"); else { int []wel = new int [1000010]; int maxx = 0...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
4fec86f21f54c59489ba8e347c9893cf
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; public class Ravenstvo { 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(); } int max = maxOf(a); int[] na =...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
693867f3c8f6aafbee42d6dcd9c88f2f
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; public class Equality{ public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int max = -999999999; int counter = 0; int list [] = new int [n]; for(int i = 0;i < n;i++){ list[i] = in.nextInt(...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
01a37916f57f78ebe86a7cc6593b5b5c
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; public class Practice{ public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int max = -999999999; int counter = 0; int list [] = new int [n]; for(int i = 0;i < n;i++){ list[i] = in.nextInt(...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
6760afb681b840aff1fa7dbc29100e94
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
/* Problem Name: Holiday Of Equality URL: http://codeforces.com/contest/758/problem/A */ import java.util.*; public class Holiday_Of_Equality{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] citizen = new int[110]; int largest = -999999; for(int...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
ed5d2ba12f53e97a7cd6a551bfe3c1eb
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { 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++) { ...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
af5dd7f3389e319e4264024c0b16c641
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class HolidayOfEquality { public static void main(String[] args) { // TODO Auto-generated method stub // Problem https://codeforces.com/problemset/problem/758/A // https://githu...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
62f99e1836beb54a077fd3d139f823f6
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.Scanner; public class HolidayOfEquality { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] sum = new int[n]; int max = 0; for(int i=0;i<sum.length;i++) { int temp = scan.nextInt(); sum[i...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
904baeaa876dac72fe88c4831ffe3191
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Holiday_Equality { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int sum = 0, max=0; int[] a = new int[n]; int[] b = new int[n]; for (int i = 0; i < ...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
6bd1993041e4cdc44ed40063b3f4924f
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.Scanner; public class JavaApplication15 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] tab = new int[n]; int i; tab[0] = sc.nextInt(); int max = tab[0]; int s = tab[0]; for (i = 1; i < n; i++) { tab[i] = sc.nextInt(); s += tab[i]; if (tab...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
3382aa83927d3ad5d066f99e20141aac
train_000.jsonl
1484838300
In Berland it is the holiday of equality. In honor of the holiday the king decided to equalize the welfare of all citizens in Berland by the expense of the state treasury. Totally in Berland there are n citizens, the welfare of each of them is estimated as the integer in ai burles (burle is the currency in Berland).You...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; /** * * @author HP */ public class JavaApplication16 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here ...
Java
["5\n0 1 2 3 4", "5\n1 1 0 1 1", "3\n1 3 1", "1\n12"]
1 second
["10", "1", "4", "0"]
NoteIn the first example if we add to the first citizen 4 burles, to the second 3, to the third 2 and to the fourth 1, then the welfare of all citizens will equal 4.In the second example it is enough to give one burle to the third citizen. In the third example it is necessary to give two burles to the first and the thi...
Java 8
standard input
[ "implementation", "math" ]
a5d3c9ea1c9affb0359d81dae4ecd7c8
The first line contains the integer n (1 ≤ n ≤ 100) — the number of citizens in the kingdom. The second line contains n integers a1, a2, ..., an, where ai (0 ≤ ai ≤ 106) — the welfare of the i-th citizen.
800
In the only line print the integer S — the minimum number of burles which are had to spend.
standard output
PASSED
198ddca23c66484004f8115549bbb006
train_000.jsonl
1407511800
Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d...
256 megabytes
import java.util.*; import java.io.*; public class Solution { static class Reader { BufferedReader br; StringTokenizer st; public Reader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringT...
Java
["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"]
1 second
["2", "4", "10"]
NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points.
Java 11
standard input
[ "dp" ]
41b3e726b8146dc733244ee8415383c0
The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105).
1,500
Print a single integer — the maximum number of points that Alex can earn.
standard output
PASSED
976308fc90607232b4b187b6723f3dd2
train_000.jsonl
1407511800
Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d...
256 megabytes
import java.util.Scanner; public class Main { static long []cnt=new long[100005]; static long []dp=new long[100005]; public static void main(String[] args) { Scanner cin=new Scanner(System.in); int n=cin.nextInt(); for(int i=0;i<n;i++){ int x=cin.nextInt(); ...
Java
["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"]
1 second
["2", "4", "10"]
NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points.
Java 11
standard input
[ "dp" ]
41b3e726b8146dc733244ee8415383c0
The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105).
1,500
Print a single integer — the maximum number of points that Alex can earn.
standard output
PASSED
55bf78cb2c68cbb9952d311d94679823
train_000.jsonl
1407511800
Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d...
256 megabytes
import java.util.*; public class cf260div2C { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int arr[]=new int[n];long cnt[]=new long[100001]; for(int i=0;i<n;i++) {arr[i]=sc.nextInt(); cnt[arr[i]]++;} cnt[0]=0; long dp[]=new long[100001]; dp[0]=0; dp[1]=cnt[1]; for(int ...
Java
["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"]
1 second
["2", "4", "10"]
NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points.
Java 11
standard input
[ "dp" ]
41b3e726b8146dc733244ee8415383c0
The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105).
1,500
Print a single integer — the maximum number of points that Alex can earn.
standard output
PASSED
1b71de694b522f32c023e7e54d571a78
train_000.jsonl
1407511800
Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d...
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[] arr = new int[n]; int[] bucket = new int[100001]; long[] ans = new long[100002]; for(int i =0 ;i<n; i++) { ...
Java
["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"]
1 second
["2", "4", "10"]
NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points.
Java 11
standard input
[ "dp" ]
41b3e726b8146dc733244ee8415383c0
The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105).
1,500
Print a single integer — the maximum number of points that Alex can earn.
standard output
PASSED
e3fc3adabea0fc3ecd815ebf23524c0c
train_000.jsonl
1407511800
Alex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it ak) and d...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.BufferedOutputStream; public class Boredom{ static class FastReader { BufferedReader br; StringTokenizer st; public FastR...
Java
["2\n1 2", "3\n1 2 3", "9\n1 2 1 3 2 2 2 2 3"]
1 second
["2", "4", "10"]
NoteConsider the third test example. At first step we need to choose any element equal to 2. After that step our sequence looks like this [2, 2, 2, 2]. Then we do 4 steps, on each step we choose any element equals to 2. In total we earn 10 points.
Java 11
standard input
[ "dp" ]
41b3e726b8146dc733244ee8415383c0
The first line contains integer n (1 ≤ n ≤ 105) that shows how many numbers are in Alex's sequence. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 105).
1,500
Print a single integer — the maximum number of points that Alex can earn.
standard output
PASSED
862c6cd02aacea83bf9f16f90815a739
train_000.jsonl
1554041100
You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (includ...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.PrintWriter; import java.util.Scanner; public class CF2 { public static final int BASE = 'z' - 'a' + 1; // 14:12- public static void main(String[] args) throws Exception { try (BufferedInputStream in = new Buf...
Java
["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]
2 seconds
["bc", "alvuw", "qoztvz"]
null
Java 8
standard input
[ "number theory", "bitmasks", "math", "strings" ]
5f4009d4065f5ad39e662095f8f5c068
The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) — the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowerca...
1,900
Print one string consisting exactly of $$$k$$$ lowercase Latin letters — the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$.
standard output
PASSED
b576c27d2e24cb8a4d2940e73f11f822
train_000.jsonl
1554041100
You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (includ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.InputMismatchException; public class P1144E { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); in...
Java
["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]
2 seconds
["bc", "alvuw", "qoztvz"]
null
Java 8
standard input
[ "number theory", "bitmasks", "math", "strings" ]
5f4009d4065f5ad39e662095f8f5c068
The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) — the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowerca...
1,900
Print one string consisting exactly of $$$k$$$ lowercase Latin letters — the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$.
standard output
PASSED
3de59957cd0c1c1af9486fe103f42678
train_000.jsonl
1554041100
You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (includ...
256 megabytes
import java.io.*; import java.math.BigInteger; @SuppressWarnings("Duplicates") public class ProblemEv2 { public static void main(String[] args) throws IOException{ //Reader sc = new Reader(); PrintWriter pw = new PrintWriter(System.out); //Scanner sc = new Scanner(System.in); Buffe...
Java
["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]
2 seconds
["bc", "alvuw", "qoztvz"]
null
Java 8
standard input
[ "number theory", "bitmasks", "math", "strings" ]
5f4009d4065f5ad39e662095f8f5c068
The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) — the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowerca...
1,900
Print one string consisting exactly of $$$k$$$ lowercase Latin letters — the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$.
standard output
PASSED
d1f32b666405e750a60b14b4e646c0b8
train_000.jsonl
1554041100
You are given two strings $$$s$$$ and $$$t$$$, both consisting of exactly $$$k$$$ lowercase Latin letters, $$$s$$$ is lexicographically less than $$$t$$$.Let's consider list of all strings consisting of exactly $$$k$$$ lowercase Latin letters, lexicographically not less than $$$s$$$ and not greater than $$$t$$$ (includ...
256 megabytes
import java.util.Scanner; public class E { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = Integer.parseInt(sc.nextLine()); String s = sc.nextLine(); String t = sc.nextLine(); //System.out.println(s); //System.out.println(t); // long startTime =System.currentTimeMi...
Java
["2\naz\nbf", "5\nafogk\nasdji", "6\nnijfvj\ntvqhwp"]
2 seconds
["bc", "alvuw", "qoztvz"]
null
Java 8
standard input
[ "number theory", "bitmasks", "math", "strings" ]
5f4009d4065f5ad39e662095f8f5c068
The first line of the input contains one integer $$$k$$$ ($$$1 \le k \le 2 \cdot 10^5$$$) — the length of strings. The second line of the input contains one string $$$s$$$ consisting of exactly $$$k$$$ lowercase Latin letters. The third line of the input contains one string $$$t$$$ consisting of exactly $$$k$$$ lowerca...
1,900
Print one string consisting exactly of $$$k$$$ lowercase Latin letters — the median (the middle element) of list of strings of length $$$k$$$ lexicographically not less than $$$s$$$ and not greater than $$$t$$$.
standard output
PASSED
74e21ca4a5c29e5c9cd9a92c7f3d5151
train_000.jsonl
1600526100
This is the easy 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 test { public static void main(String[] args)throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Scanner sc = new Scanner(System.in); int t=1; while(t-->0){ int n=Integ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
a42509343c10878f3c160db84aab38bb
train_000.jsonl
1600526100
This is the easy 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.BufferedOutputStream; 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 TaskD1 { public static void main(String[] args) { MyScanner sc = new MyScann...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
90cf857ef8726fdca7106dd6bca97936
train_000.jsonl
1600526100
This is the easy 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 segementTree { public static int mod=1000000007; public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++) arr[i]=sc.nextInt(); Arrays.sort(arr); int ans[]=new int[n]; if(...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
37c080f6994e10677f6db1a1b03959a4
train_000.jsonl
1600526100
This is the easy 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.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { var sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); var a = new int[n]; for(int i = 0; i < n; i++){ ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
b5932bcee3d2df21c5b0f608f416a13d
train_000.jsonl
1600526100
This is the easy 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
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package javaapplication2; import java.util.*; import java.util.Arrays; /** * * @author DELL */ public class JavaApplication2 { ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
d1957057356eec04378496fa50c6b6eb
train_000.jsonl
1600526100
This is the easy 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.awt.dnd.InvalidDnDOperationException; import java.io.*; import java.lang.reflect.Array; import java.nio.charset.CharsetEncoder; import java.util.*; public class Main { private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; private static final boolean OFFLINE_WITHOU...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
53b42998882f3d46b96944734f8e6795
train_000.jsonl
1600526100
This is the easy 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.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class problemD { private static void solve() throws Exception { ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
05cba2631b4bc2262a922ea9c691605d
train_000.jsonl
1600526100
This is the easy 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.*; // Author- Prashant Gupta public class D { public static void main(String[] args) throws IOException { // write your code here PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); // Scanner sc = new Scanner(System.in); Read...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
d117e6826f5de23952c45eed74795be9
train_000.jsonl
1600526100
This is the easy 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 Codeforces{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); sc.nextLine(); String[] arr=sc.nextLine().split(" "); Arrays.sort(arr,new Comparator<String>() { public int compare(String s1,String s2) { return Integer.valu...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
411ad360dc50bb7c61247e1b8560cf8f
train_000.jsonl
1600526100
This is the easy 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.lang.*; import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new Buf...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
8050a59c81052d0613fb46edfa0a6b6b
train_000.jsonl
1600526100
This is the easy 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.Arrays; import java.util.Collections; import java.util.Scanner; public class SagesBirthday { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int buys = 0; int cakes = sc.nextInt(); int[] arr = new int[cakes]; for(int i =...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
be0fa3c640d08c532a9400d5463cda02
train_000.jsonl
1600526100
This is the easy 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.Arrays; import java.util.Collections; import java.util.Scanner; public class SagesBirthday { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int buys = 0; int cakes = sc.nextInt(); int[] arr = new int[cakes]; for...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
bab5e8c32d24d5e8434b43a0069e8643
train_000.jsonl
1600526100
This is the easy 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 Sage { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long ar[]= new long[n]; long ar1[]=new long[n]; for(int i =0;i<n;i++) ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
28362d89d2616913e72cd9a90a5376d2
train_000.jsonl
1600526100
This is the easy 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 Yo { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++) { arr[i]=sc.nextInt(); } Arrays.sort(arr); if(n%2==0) System.out.println(n/2-1); else System...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
8fd2109789034b1aaf0b85e364647a00
train_000.jsonl
1600526100
This is the easy 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 ru.ilinchik.codeforces; import java.util.Arrays; import java.util.Scanner; public class D671 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = in.ne...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
313ce9eb73f8dbaa0411e33a6f8ae60f
train_000.jsonl
1600526100
This is the easy 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 MyClass { public static void main(String args[]) { Scanner s = new Scanner(System.in); int t = s.nextInt(); int q=t; ArrayList<Integer> arr = new ArrayList<Integer>(); while(q-->0){ int p = s.nextInt(); arr.add(p); } Col...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
6670234a452e5880c0fbb3ff3b75d00c
train_000.jsonl
1600526100
This is the easy 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.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class T4 { public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new InputStreamReader(Syst...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
00420bb85132dbfbeb520ca085145d5f
train_000.jsonl
1600526100
This is the easy 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.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
bf68f6899821cc3e048ad8e135fdb409
train_000.jsonl
1600526100
This is the easy 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 Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
1ae5ba2483707bfb15f24d68a84a833e
train_000.jsonl
1600526100
This is the easy 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 com.sun.source.tree.Tree; import javax.naming.spi.DirObjectFactory; import javax.xml.crypto.dsig.spec.XSLTTransformParameterSpec; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigDecimal; im...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
be86d52bfa5a25ef7ba7576ae215c0af
train_000.jsonl
1600526100
This is the easy 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 SagesBirthday { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
992baf8af84c1bebacb7c32def2db2e2
train_000.jsonl
1600526100
This is the easy 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.Writer; import java.io.BufferedWriter; import java.io.OutputStreamWriter; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; import java.util.Arrays; import java.util.ArrayList; import java.util.InputMismatchExcept...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
50db91840d581b4a41e720c27de66cce
train_000.jsonl
1600526100
This is the easy 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 java.util.stream.Collectors; public class D1 { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); int ar[] = sc.nextIntArray(n); sort(ar); int ans[] = new int[n]; int k = 0...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
6b33663b1ccee86e954b90dae8c7d5e8
train_000.jsonl
1600526100
This is the easy 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 java.util.stream.Collectors; public class D1 { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); int ar[] = sc.nextIntArray(n); sort(ar); for(int i = 0; i < n-1; i+=2) { ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
8e0e2dc533672c7bfb3581b6db8e088a
train_000.jsonl
1600526100
This is the easy 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.Arrays; import java.util.StringTokenizer; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
a55c35dc40f534c403c8dafd5c2a9514
train_000.jsonl
1600526100
This is the easy 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 Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // Main o = new Main(); int n = in.nextInt(); long[] arr = new long[n]; for (int i = 0; i < n; ++i) arr[i] = in.nextInt(); Arrays.sort(arr)...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
bbf9c669ea035b5007c0ffde709a4d9e
train_000.jsonl
1600526100
This is the easy 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 D_671_1 { static int p=1000000007; public static void main(String[] args) throws Exception{ BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512); FastReader sc=new FastR...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
4b333ecce0c657c9a788c4d5430030d6
train_000.jsonl
1600526100
This is the easy 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 D_671_1 { static int p=1000000007; public static void main(String[] args) throws Exception{ BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512); FastReader sc=new FastR...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
ef1739a90fd183b68ae71886c2349985
train_000.jsonl
1600526100
This is the easy 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 D { static FastReader f = new FastReader(); static PrintWriter out = new PrintWriter(System.out); public static void main(String[] args) { //int t = f.nextInt(); //while(t-- > 0) solve(); out.close(); } static void solve() { int n = f.nextInt(); ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
5da5ff081c76f1e7d14b8612bbdb8f6c
train_000.jsonl
1600526100
This is the easy 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.*;import java.math.*; public class Birthday { public static void process()throws IOException { int n = ni(); int[] a = nai(n); ruffleSort(a); if(n == 1 || n == 2){ pn(0); for(int i = 0; i < n; i++) p(a[i]+"...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
3b002f0ca75d8b3e8e176c443ad5012c
train_000.jsonl
1600526100
This is the easy 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.*;import java.math.*; public class Birthday { public static void process()throws IOException { int n = ni(); int[] a = nai(n); ruffleSort(a); int c = 0, total = 0; int[] ans = new int[n]; for(int i = 1; i < n-1; i+=2){ ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
298c3adaa40d656240c6268e17555b46
train_000.jsonl
1600526100
This is the easy 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 Main { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); ArrayList<Integer> list=new ArrayList<>(); for(int i=0;i<n;i++) list.add(sc.nextInt()); Collections.sort(list); System.o...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
aecc650beb4198dd8bd1d2f2261fc3ba
train_000.jsonl
1600526100
This is the easy 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.*; import java.math.*; public class Main{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } ...
Java
["5\n1 2 3 4 5"]
1 second
["2\n3 1 4 2 5"]
NoteIn the example it's not possible to place ice spheres in any order so that Sage would buy $$$3$$$ of them. If the ice spheres are placed like this $$$(3, 1, 4, 2, 5)$$$, then Sage will buy two spheres: one for $$$1$$$ and one for $$$2$$$, because they are cheap.
Java 11
standard input
[ "constructive algorithms", "binary search", "sortings", "greedy" ]
bcd9439fbf6aedf6882612d5f7d6220f
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$$$ different integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres.
1,000
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
039831ae03d8a9784aaf5283c43d7a02
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.io.*; import java.util.*; public class Main{ //public static Reader sc = new Reader(); public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException{ String s = br.readLine(); TreeSet<Character> tr = new TreeSet<...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
1842314ad911a16c65a45c721d34e7dd
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.util.*; public class B { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); char a[] = sc.next().toCharArray(); System.out.println("Mike"); char min = a[0]; for(int ...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
c121942e9205e4a5e853868b638959c3
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.util.*; import java.io.*; public final class Codeforces{ public static void main(String[] args) throws IOException{ StringBuffer buff=new StringBuffer(); BufferedReader buffer=new BufferedReader(new InputStreamReader(System.in)); String s=buffer.readLine(); int n=s.length...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
2074faee828619a75564c5a08139f1dd
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.awt.Point; import java.io.*; import java.util.*; import java.math.BigInteger; public class Winner { static class Solver { public void solve(MyReader in, PrintWriter out) { String s = in.next(); int n = s.length(); char min = s.charAt(0); boolean...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
80aab9802e62ed74ffb413c730351b36
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; import java.util.stream.Stream; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); System.out.println(solve(s)); sc.close(); } static String solve(Stri...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
c27e3621b196f9363a7531e807547182
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { FastScanner sc=new FastScanner(System.in); PrintWriter out=new PrintWriter(System.out); S...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
fc966d70d8ab062d82a0f44e1c5825e2
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.util.*; import java.lang.*; import java.io.*; import java.awt.Point; // SHIVAM GUPTA : //NSIT //decoder_1671 // STOP NOT TILL IT IS DONE OR U DIE . // U KNOW THAT IF THIS DAY WILL BE URS THEN NO ONE CAN DEFEAT U HERE................ // ASCII = 48 + i ;// 2^28 = 268,435,456 > 2* 10^8 // log 10 base 2 = ...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
cbd21b110dc7deb572e3cf6f51ef84af
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
// practice with kaiboy import java.io.*; import java.util.*; public class CF1220C extends PrintWriter { CF1220C() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1220C o = new CF1220C(); o.main(); o.flush(); } void main() { byte[] cc = sc.next().getBytes()...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
77ff6e4e9a8d41aad18084e2a5dc0cbe
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.util.*; import java.io.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); String str = sc.next(); char arr[] = str.toCharArray(), minchar=arr[0]; out.println("Mike"); ...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
29daadc22721fa5cdcbfa37104950d5b
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class Competetive { public static void main(String[] args) { FastScanner sc=new FastScanner(); PrintWriter out=new PrintWriter(System.out); char s[]=sc.next().toCharArray(); out.println("Mike"); char c=s[0]; for(int i=1;i<s.length;...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
11c5b2221dea2f07879edd94f48025b2
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.io.*; import java.util.*; import static java.util.Collections.*; import static java.lang.Math.*; import java.util.stream.*; @SuppressWarnings("unchecked") public class C_Substring_Game_in_the_Lesson { public static PrintWriter out; public static InputReader in; public static long MOD = (long)1e...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
1046abf8f40849bbbd796c4a769e53e1
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
c8779e15d648a86951502750a4dd515f
train_000.jsonl
1568822700
Mike and Ann are sitting in the classroom. The lesson is boring, so they decided to play an interesting game. Fortunately, all they need to play this game is a string $$$s$$$ and a number $$$k$$$ ($$$0 \le k &lt; |s|$$$).At the beginning of the game, players are given a substring of $$$s$$$ with left border $$$l$$$ and...
256 mebibytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Main implements Runnable { boolean multiple = false; long MOD = 998244353; @SuppressWarnings("Duplicates") void solve() throws Exception { String s = sc.nextToken(); int n = s.length(); int[]...
Java
["abba", "cba"]
2 seconds
["Mike\nAnn\nAnn\nMike", "Mike\nMike\nMike"]
null
Java 11
null
[ "greedy", "games", "strings" ]
1e107d9fb8bead4ad942b857685304c4
The first line of the input contains a single string $$$s$$$ ($$$1 \leq |s| \leq 5 \cdot 10^5$$$) consisting of lowercase English letters.
1,300
Print $$$|s|$$$ lines. In the line $$$i$$$ write the name of the winner (print Mike or Ann) in the game with string $$$s$$$ and $$$k = i$$$, if both play optimally
null
PASSED
add80bef14bdaa326f10d4b75769dc5a
train_000.jsonl
1519058100
Fifa and Fafa are sharing a flat. Fifa loves video games and wants to download a new soccer game. Unfortunately, Fafa heavily uses the internet which consumes the quota. Fifa can access the internet through his Wi-Fi access point. This access point can be accessed within a range of r meters (this range can be chosen by...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class File { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // Flat radius: double R = sc.nextDouble(); // Flat coordinates: double x1 = sc.nextDouble(); double y1 = sc.nextDouble(); // Fafa ...
Java
["5 3 3 1 1", "10 5 5 5 15"]
1 second
["3.7677669529663684 3.7677669529663684 3.914213562373095", "5.0 5.0 10.0"]
null
Java 11
standard input
[ "geometry" ]
29d4ca13888c0e172dde315b66380fe5
The single line of the input contains 5 space-separated integers R, x1, y1, x2, y2 (1 ≤ R ≤ 105, |x1|, |y1|, |x2|, |y2| ≤ 105).
1,600
Print three space-separated numbers xap, yap, r where (xap, yap) is the position which Fifa chose for the access point and r is the radius of its range. Your answer will be considered correct if the radius does not differ from optimal more than 10 - 6 absolutely or relatively, and also the radius you printed can be ch...
standard output
PASSED
bdf80909f1329f38dad9e049388479eb
train_000.jsonl
1519058100
Fifa and Fafa are sharing a flat. Fifa loves video games and wants to download a new soccer game. Unfortunately, Fafa heavily uses the internet which consumes the quota. Fifa can access the internet through his Wi-Fi access point. This access point can be accessed within a range of r meters (this range can be chosen by...
256 megabytes
// practice with kaiboy import java.io.*; import java.util.*; public class CF935C extends PrintWriter { CF935C() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF935C o = new CF935C(); o.main(); o.flush(); } void main() { int R = sc.nextInt(); int x1...
Java
["5 3 3 1 1", "10 5 5 5 15"]
1 second
["3.7677669529663684 3.7677669529663684 3.914213562373095", "5.0 5.0 10.0"]
null
Java 11
standard input
[ "geometry" ]
29d4ca13888c0e172dde315b66380fe5
The single line of the input contains 5 space-separated integers R, x1, y1, x2, y2 (1 ≤ R ≤ 105, |x1|, |y1|, |x2|, |y2| ≤ 105).
1,600
Print three space-separated numbers xap, yap, r where (xap, yap) is the position which Fifa chose for the access point and r is the radius of its range. Your answer will be considered correct if the radius does not differ from optimal more than 10 - 6 absolutely or relatively, and also the radius you printed can be ch...
standard output