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
a2c3d04460c2604a925fecdd6b521ebb
train_002.jsonl
1397837400
The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the building.The slogan of the company consists of n characters, so the decorators hung a large...
256 megabytes
import java.util.Scanner; public class z_1 { public static void main(String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); String s = in.next(); if(k > s.length()-k){ for(int i = k-1; i < s.length()-1;i++){ System.out.println("RIGHT"); } ...
Java
["2 2\nR1", "2 1\nR1", "6 4\nGO?GO!"]
1 second
["PRINT 1\nLEFT\nPRINT R", "PRINT R\nRIGHT\nPRINT 1", "RIGHT\nRIGHT\nPRINT !\nLEFT\nPRINT O\nLEFT\nPRINT G\nLEFT\nPRINT ?\nLEFT\nPRINT O\nLEFT\nPRINT G"]
NoteNote that the ladder cannot be shifted by less than one meter. The ladder can only stand in front of some square of the poster. For example, you cannot shift a ladder by half a meter and position it between two squares. Then go up and paint the first character and the second character.
Java 7
standard input
[ "implementation", "greedy" ]
e3a03f3f01a77a1983121bab4218c39c
The first line contains two integers, n and k (1 ≤ k ≤ n ≤ 100) — the number of characters in the slogan and the initial position of the ladder, correspondingly. The next line contains the slogan as n characters written without spaces. Each character of the slogan is either a large English letter, or digit, or one of t...
900
In t lines, print the actions the programmers need to make. In the i-th line print: "LEFT" (without the quotes), if the i-th action was "move the ladder to the left"; "RIGHT" (without the quotes), if the i-th action was "move the ladder to the right"; "PRINT x" (without the quotes), if the i-th action was to "go up...
standard output
PASSED
a823a190efa35c9c855a7b90792b5186
train_002.jsonl
1397837400
The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the building.The slogan of the company consists of n characters, so the decorators hung a large...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import static java.util.Arrays.*; import static java.lang.Math.*; public class Main { static boolean LOCAL = System.getSecurityManager() == null; Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); void run() { int n = i...
Java
["2 2\nR1", "2 1\nR1", "6 4\nGO?GO!"]
1 second
["PRINT 1\nLEFT\nPRINT R", "PRINT R\nRIGHT\nPRINT 1", "RIGHT\nRIGHT\nPRINT !\nLEFT\nPRINT O\nLEFT\nPRINT G\nLEFT\nPRINT ?\nLEFT\nPRINT O\nLEFT\nPRINT G"]
NoteNote that the ladder cannot be shifted by less than one meter. The ladder can only stand in front of some square of the poster. For example, you cannot shift a ladder by half a meter and position it between two squares. Then go up and paint the first character and the second character.
Java 7
standard input
[ "implementation", "greedy" ]
e3a03f3f01a77a1983121bab4218c39c
The first line contains two integers, n and k (1 ≤ k ≤ n ≤ 100) — the number of characters in the slogan and the initial position of the ladder, correspondingly. The next line contains the slogan as n characters written without spaces. Each character of the slogan is either a large English letter, or digit, or one of t...
900
In t lines, print the actions the programmers need to make. In the i-th line print: "LEFT" (without the quotes), if the i-th action was "move the ladder to the left"; "RIGHT" (without the quotes), if the i-th action was "move the ladder to the right"; "PRINT x" (without the quotes), if the i-th action was to "go up...
standard output
PASSED
4445f146a50f6f8fee48b3e77bde33ce
train_002.jsonl
1397837400
The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the building.The slogan of the company consists of n characters, so the decorators hung a large...
256 megabytes
import java.util.Scanner; public class CS_A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), k = sc.nextInt(); String s = sc.next(); if (n / 2 <k) { if (n != k) for (int i = k; i < n; i++) { System.out.println("RIGHT"); } for (int i = s.l...
Java
["2 2\nR1", "2 1\nR1", "6 4\nGO?GO!"]
1 second
["PRINT 1\nLEFT\nPRINT R", "PRINT R\nRIGHT\nPRINT 1", "RIGHT\nRIGHT\nPRINT !\nLEFT\nPRINT O\nLEFT\nPRINT G\nLEFT\nPRINT ?\nLEFT\nPRINT O\nLEFT\nPRINT G"]
NoteNote that the ladder cannot be shifted by less than one meter. The ladder can only stand in front of some square of the poster. For example, you cannot shift a ladder by half a meter and position it between two squares. Then go up and paint the first character and the second character.
Java 7
standard input
[ "implementation", "greedy" ]
e3a03f3f01a77a1983121bab4218c39c
The first line contains two integers, n and k (1 ≤ k ≤ n ≤ 100) — the number of characters in the slogan and the initial position of the ladder, correspondingly. The next line contains the slogan as n characters written without spaces. Each character of the slogan is either a large English letter, or digit, or one of t...
900
In t lines, print the actions the programmers need to make. In the i-th line print: "LEFT" (without the quotes), if the i-th action was "move the ladder to the left"; "RIGHT" (without the quotes), if the i-th action was "move the ladder to the right"; "PRINT x" (without the quotes), if the i-th action was to "go up...
standard output
PASSED
1f2366af9b3e6b4bbde0bfc176ca7a42
train_002.jsonl
1397837400
The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the building.The slogan of the company consists of n characters, so the decorators hung a large...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Exercise1 implements Runnable { static BufferedReader in; static PrintWriter out; static StringTokenizer st; private void solve() throws IOException { int length = nextInt(); int currentPos = nextInt(); S...
Java
["2 2\nR1", "2 1\nR1", "6 4\nGO?GO!"]
1 second
["PRINT 1\nLEFT\nPRINT R", "PRINT R\nRIGHT\nPRINT 1", "RIGHT\nRIGHT\nPRINT !\nLEFT\nPRINT O\nLEFT\nPRINT G\nLEFT\nPRINT ?\nLEFT\nPRINT O\nLEFT\nPRINT G"]
NoteNote that the ladder cannot be shifted by less than one meter. The ladder can only stand in front of some square of the poster. For example, you cannot shift a ladder by half a meter and position it between two squares. Then go up and paint the first character and the second character.
Java 7
standard input
[ "implementation", "greedy" ]
e3a03f3f01a77a1983121bab4218c39c
The first line contains two integers, n and k (1 ≤ k ≤ n ≤ 100) — the number of characters in the slogan and the initial position of the ladder, correspondingly. The next line contains the slogan as n characters written without spaces. Each character of the slogan is either a large English letter, or digit, or one of t...
900
In t lines, print the actions the programmers need to make. In the i-th line print: "LEFT" (without the quotes), if the i-th action was "move the ladder to the left"; "RIGHT" (without the quotes), if the i-th action was "move the ladder to the right"; "PRINT x" (without the quotes), if the i-th action was to "go up...
standard output
PASSED
8072b76b795fdd58717cd1d889ba784a
train_002.jsonl
1397837400
The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the building.The slogan of the company consists of n characters, so the decorators hung a large...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.PriorityQueue; import java.util.Stri...
Java
["2 2\nR1", "2 1\nR1", "6 4\nGO?GO!"]
1 second
["PRINT 1\nLEFT\nPRINT R", "PRINT R\nRIGHT\nPRINT 1", "RIGHT\nRIGHT\nPRINT !\nLEFT\nPRINT O\nLEFT\nPRINT G\nLEFT\nPRINT ?\nLEFT\nPRINT O\nLEFT\nPRINT G"]
NoteNote that the ladder cannot be shifted by less than one meter. The ladder can only stand in front of some square of the poster. For example, you cannot shift a ladder by half a meter and position it between two squares. Then go up and paint the first character and the second character.
Java 7
standard input
[ "implementation", "greedy" ]
e3a03f3f01a77a1983121bab4218c39c
The first line contains two integers, n and k (1 ≤ k ≤ n ≤ 100) — the number of characters in the slogan and the initial position of the ladder, correspondingly. The next line contains the slogan as n characters written without spaces. Each character of the slogan is either a large English letter, or digit, or one of t...
900
In t lines, print the actions the programmers need to make. In the i-th line print: "LEFT" (without the quotes), if the i-th action was "move the ladder to the left"; "RIGHT" (without the quotes), if the i-th action was "move the ladder to the right"; "PRINT x" (without the quotes), if the i-th action was to "go up...
standard output
PASSED
17a458f2cfab5f34f5b58c2571392641
train_002.jsonl
1397837400
The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the building.The slogan of the company consists of n characters, so the decorators hung a large...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Slogan { public static void main(String ...args) throws IOException { BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); String input = in.readLine(); String[] inputArray= input.s...
Java
["2 2\nR1", "2 1\nR1", "6 4\nGO?GO!"]
1 second
["PRINT 1\nLEFT\nPRINT R", "PRINT R\nRIGHT\nPRINT 1", "RIGHT\nRIGHT\nPRINT !\nLEFT\nPRINT O\nLEFT\nPRINT G\nLEFT\nPRINT ?\nLEFT\nPRINT O\nLEFT\nPRINT G"]
NoteNote that the ladder cannot be shifted by less than one meter. The ladder can only stand in front of some square of the poster. For example, you cannot shift a ladder by half a meter and position it between two squares. Then go up and paint the first character and the second character.
Java 7
standard input
[ "implementation", "greedy" ]
e3a03f3f01a77a1983121bab4218c39c
The first line contains two integers, n and k (1 ≤ k ≤ n ≤ 100) — the number of characters in the slogan and the initial position of the ladder, correspondingly. The next line contains the slogan as n characters written without spaces. Each character of the slogan is either a large English letter, or digit, or one of t...
900
In t lines, print the actions the programmers need to make. In the i-th line print: "LEFT" (without the quotes), if the i-th action was "move the ladder to the left"; "RIGHT" (without the quotes), if the i-th action was "move the ladder to the right"; "PRINT x" (without the quotes), if the i-th action was to "go up...
standard output
PASSED
f4fc91c33304379624ea957c2ad1aee7
train_002.jsonl
1397837400
The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the building.The slogan of the company consists of n characters, so the decorators hung a large...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); String slogan = sc.next(); char[] slogans = slogan.toCharArray(); if(k>n*1.0/2){ for(int i = 0 ; i < n-k;i++){ System.out.println("RI...
Java
["2 2\nR1", "2 1\nR1", "6 4\nGO?GO!"]
1 second
["PRINT 1\nLEFT\nPRINT R", "PRINT R\nRIGHT\nPRINT 1", "RIGHT\nRIGHT\nPRINT !\nLEFT\nPRINT O\nLEFT\nPRINT G\nLEFT\nPRINT ?\nLEFT\nPRINT O\nLEFT\nPRINT G"]
NoteNote that the ladder cannot be shifted by less than one meter. The ladder can only stand in front of some square of the poster. For example, you cannot shift a ladder by half a meter and position it between two squares. Then go up and paint the first character and the second character.
Java 7
standard input
[ "implementation", "greedy" ]
e3a03f3f01a77a1983121bab4218c39c
The first line contains two integers, n and k (1 ≤ k ≤ n ≤ 100) — the number of characters in the slogan and the initial position of the ladder, correspondingly. The next line contains the slogan as n characters written without spaces. Each character of the slogan is either a large English letter, or digit, or one of t...
900
In t lines, print the actions the programmers need to make. In the i-th line print: "LEFT" (without the quotes), if the i-th action was "move the ladder to the left"; "RIGHT" (without the quotes), if the i-th action was "move the ladder to the right"; "PRINT x" (without the quotes), if the i-th action was to "go up...
standard output
PASSED
396b1a4ccb8f97d1b2e9238441a969b0
train_002.jsonl
1397837400
The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the building.The slogan of the company consists of n characters, so the decorators hung a large...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Strike2014R1A { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] parts; parts = br.readLine().split(" "); i...
Java
["2 2\nR1", "2 1\nR1", "6 4\nGO?GO!"]
1 second
["PRINT 1\nLEFT\nPRINT R", "PRINT R\nRIGHT\nPRINT 1", "RIGHT\nRIGHT\nPRINT !\nLEFT\nPRINT O\nLEFT\nPRINT G\nLEFT\nPRINT ?\nLEFT\nPRINT O\nLEFT\nPRINT G"]
NoteNote that the ladder cannot be shifted by less than one meter. The ladder can only stand in front of some square of the poster. For example, you cannot shift a ladder by half a meter and position it between two squares. Then go up and paint the first character and the second character.
Java 7
standard input
[ "implementation", "greedy" ]
e3a03f3f01a77a1983121bab4218c39c
The first line contains two integers, n and k (1 ≤ k ≤ n ≤ 100) — the number of characters in the slogan and the initial position of the ladder, correspondingly. The next line contains the slogan as n characters written without spaces. Each character of the slogan is either a large English letter, or digit, or one of t...
900
In t lines, print the actions the programmers need to make. In the i-th line print: "LEFT" (without the quotes), if the i-th action was "move the ladder to the left"; "RIGHT" (without the quotes), if the i-th action was "move the ladder to the right"; "PRINT x" (without the quotes), if the i-th action was to "go up...
standard output
PASSED
d1213df91df73b6180e338c53f0620d4
train_002.jsonl
1397837400
The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the building.The slogan of the company consists of n characters, so the decorators hung a large...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int k = scan.nextInt(); scan.nextLine(); String losung = scan.nextLine(); if(n - k < k){ for (int i = k - 1;...
Java
["2 2\nR1", "2 1\nR1", "6 4\nGO?GO!"]
1 second
["PRINT 1\nLEFT\nPRINT R", "PRINT R\nRIGHT\nPRINT 1", "RIGHT\nRIGHT\nPRINT !\nLEFT\nPRINT O\nLEFT\nPRINT G\nLEFT\nPRINT ?\nLEFT\nPRINT O\nLEFT\nPRINT G"]
NoteNote that the ladder cannot be shifted by less than one meter. The ladder can only stand in front of some square of the poster. For example, you cannot shift a ladder by half a meter and position it between two squares. Then go up and paint the first character and the second character.
Java 7
standard input
[ "implementation", "greedy" ]
e3a03f3f01a77a1983121bab4218c39c
The first line contains two integers, n and k (1 ≤ k ≤ n ≤ 100) — the number of characters in the slogan and the initial position of the ladder, correspondingly. The next line contains the slogan as n characters written without spaces. Each character of the slogan is either a large English letter, or digit, or one of t...
900
In t lines, print the actions the programmers need to make. In the i-th line print: "LEFT" (without the quotes), if the i-th action was "move the ladder to the left"; "RIGHT" (without the quotes), if the i-th action was "move the ladder to the right"; "PRINT x" (without the quotes), if the i-th action was to "go up...
standard output
PASSED
c26a21d60739f72736963b743fb8c256
train_002.jsonl
1397837400
The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the building.The slogan of the company consists of n characters, so the decorators hung a large...
256 megabytes
//package CoderStrike2014; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * * @author tino chagua */ public class A { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { BufferedRea...
Java
["2 2\nR1", "2 1\nR1", "6 4\nGO?GO!"]
1 second
["PRINT 1\nLEFT\nPRINT R", "PRINT R\nRIGHT\nPRINT 1", "RIGHT\nRIGHT\nPRINT !\nLEFT\nPRINT O\nLEFT\nPRINT G\nLEFT\nPRINT ?\nLEFT\nPRINT O\nLEFT\nPRINT G"]
NoteNote that the ladder cannot be shifted by less than one meter. The ladder can only stand in front of some square of the poster. For example, you cannot shift a ladder by half a meter and position it between two squares. Then go up and paint the first character and the second character.
Java 7
standard input
[ "implementation", "greedy" ]
e3a03f3f01a77a1983121bab4218c39c
The first line contains two integers, n and k (1 ≤ k ≤ n ≤ 100) — the number of characters in the slogan and the initial position of the ladder, correspondingly. The next line contains the slogan as n characters written without spaces. Each character of the slogan is either a large English letter, or digit, or one of t...
900
In t lines, print the actions the programmers need to make. In the i-th line print: "LEFT" (without the quotes), if the i-th action was "move the ladder to the left"; "RIGHT" (without the quotes), if the i-th action was "move the ladder to the right"; "PRINT x" (without the quotes), if the i-th action was to "go up...
standard output
PASSED
33269a55e5272a20ecc49c29390703aa
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class A461 { public static void main(String args[])throws Exception { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); long sum = 0; int [] a = new int[n]; for( int i = 0 ; i < n ; i++ ...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
e2c30225b6206ee5b4fbef61f8ec695a
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class CF461A { public static void main(String[] args){ Scanner input = new Scanner(System.in); int n; long sum=0; n=input.nextInt(); int[] a = new int[n]; for (int i=0;i<n;i++){ a[i]=input.nextInt(...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
5bea03b0fbc2e093e439ce54eded1b2d
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
//если в этой задаче нужно выводить формулу, и оно работает -- я не знаю, как оно работает :) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Codeforces { private static final int INF = (int) 1e9; ...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
4d762fb1a167ef81bc968b35e8080a17
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Arrays; /** * Created by bharani on 30/4/15. */ public class A461 { public static void main(String[] args) throws IOException{ BufferedReader ip = new BufferedReader(...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
83f522d4850bab6f4ce7dcc5c297e9fc
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class ApplemanAndToastman { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] inputs = new int[n]; long sum = 0L; for(int i=0; i<n; i++) { inputs[i]...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
0c4dc05fb673d9033e9905c69e503121
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.Scanner; public class MyClass { public static void quickSort(int[] arr, int lo, int hi) { if(lo<hi) { int p = partition(arr,lo,hi); int right; for(right = p + 1; right<hi;right++) { if(arr[right] != a...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
31afab888fc10d2407c48a8fcdc20087
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.Arrays; import java.util.Scanner; /* * 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. */ /** * * @author zpan004 */ public class Main{ Scanner sc; long[] ...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
a85db2b11e9f553b69b8dd1c087a1acc
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; public class A_461_Appleman_and_Toastman { public static void main(String[] args){ Scanner input=new Scanner(System.in); int n=input.nextInt(); int[] nums=new int[n]; for(int i=0;i<n;i++){ nums[i]=input.nextInt(); } A...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
9847f5983ceea55b93c8f06af702e37e
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String line; StringTokenizer st; StringBuilder sb = new StringBuilder(); int ...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
f50409e41b58b26b233972aa8949374d
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; im...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
e532e047d6e51c3b66ab2728ea01cbf5
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.*; import java.io.*; public class a461 { public static void main(String ar[])throws IOException { BufferedReader ob=new BufferedReader(new InputStreamReader(System.in)); //Scanner ob=new Scanner(System.in); int n=Integer.parseInt(ob.readLine()); String s[]=ob.rea...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
6d8389359702be264bc56fcc5c821dbb
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.*; public class a461 { public static void main(String ar[]) { Scanner ob=new Scanner(System.in); int n=ob.nextInt(); int arr[]=new int[n]; long sum=0,result=0; for(int i=0;i<n;i++) { arr[i]=ob.nextInt(); sum+=arr[i]; ...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
3d19a2eb3bf308dea5503953b54653c3
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.util.NoSuchElementException; import jav...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
b00a6ec1fb7f3f3ad74cdbed21ee7ec7
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.*; public class Apple { public static void main(String[] args) { Scanner input = new Scanner(System.in); long num = input.nextLong(); long score = 0; long[] numbers = new long[(int)num]; for (int i = 0; i < num; i++) { numbers[i] = input.nextLong(); } Arrays.sort(...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
790749694c74c78d740b854b4ed51341
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; import sun.security.util.BigInt; /* * 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. */ /** * * @author Ho...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
bbd8eb3974bedd64372882eba9c7b350
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.Arrays; import java.util.Scanner; /** * Created by Baka on 25.05.2016. */ public class YablovAndTostov { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); Long[] a = new Long[n]; long cs = 0; fo...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
83876a20cf9dd5d173b734e54ea35d01
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.io.*; import java.util.*; public class A{ public static boolean DEBUG = true; public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int n ...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
56b3f26355a0a822bc067bbc5bfb97f6
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Arrays; import java.lang.*; import java.util.*; import java.math.*; import java.util.Collections; import java.util.Comparator; import java.util.StringTokenizer; import java.lang.String; public class Solution { public stat...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
de2a4694ec0c90a6e11891705ee57649
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class A { public static void main(String[] args) { Scanner inScanner = new Scanner(System.in); int n = inScanner.nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = inScanner.nextInt(); } Arrays.sort(a); ...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
850f0ab177859ccbecf785e3c880bf34
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class A { public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); // Scanner scan = new Scanner(System.in); // PrintWriter out = ne...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
f6623200c60cb6235dd7afb400b4aab1
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class cola { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] arr = new int[n]; long score = 0; for (int i = 0; i < n; i++) { arr[i] = in.nextI...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
4627e0efbdcd8187e0258dc1fe8655dc
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class A263{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long a[] = new long[300111]; long sum = 0, ans = 0; for(int i = 0; i < n; i++) { a[i] =...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
a65ae705b3a3990b25c40a86731b700e
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class AppleManAndToastMan461A { public static void main(String[] args) { Scanner in = new Scanner(System.in); int num = in.nextInt(); ArrayList<Integer> values = new ArrayList<Integer>(); whil...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
7776c019870a0bb41c3cb61b51e15b14
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class A264 { public static void main(String[] args){ Scanner s=new Scanner(System.in); int n = Integer.parseInt(s.nextLine()); int f[] = new int[n]; String[] temp = s.nextLine().split(" "); for (int i = 0; i < n; i++...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
661882ff4a3b88a0f8fc8f095d82d2a8
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
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.StringTokenizer; public class NextRound { static class Reader { BufferedRea...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
37d912e0ca2b5b748e4dfb9d99add6a5
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.List; import java.io.InputStreamReader; import java.io.IOException; import java.math.BigDecimal; import java.util.Arrays; import java.util.ArrayList; import java.awt.Point; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.St...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
b37adb470604c106aa3b49257a32c80a
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.io.InputStreamReader; import java.io.BufferedReader; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class CF461A { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for(S...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
0bd95c9371b0fdc4ef7a22d79cfda291
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
//package javaapplication1; import java.util.*; import java.io.*; public class JavaApplication1 implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); final boolean OJ = System.getProperty("ONLINE_JUDGE") != null; void init() throws FileNotFoun...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
3df203c927935e5e5c2b34faa8159243
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.PriorityQueue; import java.util.Scanner; import javax.swing.InputMap; public class ApplemanA { /** * @param args * @throws IOException */ public static void main(String[] arg...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
6fa67970e14feedfdf67c16e509007a9
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class ApplemanandToastman { static long total = 0; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num_of_num = sc.nextInt(); int[] nums = new int[num_of_num]; long tempSum = 0; int minValue = 1000001; for (i...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
b47e928a89a1a81410293e56e6f223f0
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class ApplemanandToastman { static long total = 0; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num_of_num = sc.nextInt(); List<Integer> nums = new ArrayLis...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
6582bee89a6ed343813f8d33e36e6355
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Task461A { public static void main(String... args) throws NumberFormatException, IOException { Solution.main(System.in, System.out); } static class Scanner { privat...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
befe9925272a74e7a082b79b890cd14c
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.*; import java.io.*; public class test { static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } ...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
acf829f26d6c1ae73f48cae30a0921f1
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class R263D1A { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
132db242a8fe86551ea2f146c8cdc061
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.lang.*; import java.io.*; import java.util.*; public class Toastman { public static void main(String[] args) throws java.lang.Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
9c205b63252d86bb63e0f542353b5333
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.util.ArrayList; import java.util.Comparator; import java.util.Collections; public class Toastman { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n = cin.nextInt(); long[] sums = new long[n]; //ArrayList<int> su...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
8d9d66d0d6a50f2dda777758e71e3138
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.util.ArrayList; import java.util.Comparator; import java.util.Collections; public class Toastman { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n = cin.nextInt(); long[] sums = new long[n]; //ArrayList<int> su...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
2a06e6657babee162ba58f43f9ba02b5
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchExcep...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
63cb829e0384abe9475b5365afe00ac7
train_002.jsonl
1409061600
Appleman and Toastman play a game. Initially Appleman gives one group of n numbers to the Toastman, then they start to complete the following tasks: Each time Toastman gets a group of numbers, he sums up all the numbers and adds this sum to the score. Then he gives the group to the Appleman. Each time Appleman gets a...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; import static java.lang.System.out; import java.util.Arrays; public class Main { static StreamTokenizer in; public static void main(String[] args) throws IOException { in = ...
Java
["3\n3 1 5", "1\n10"]
2 seconds
["26", "10"]
NoteConsider the following situation in the first example. Initially Toastman gets group [3, 1, 5] and adds 9 to the score, then he give the group to Appleman. Appleman splits group [3, 1, 5] into two groups: [3, 5] and [1]. Both of them should be given to Toastman. When Toastman receives group [1], he adds 1 to score ...
Java 7
standard input
[ "sortings", "greedy" ]
4266948a2e793b4b461156af226e98fd
The first line contains a single integer n (1 ≤ n ≤ 3·105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the initial group that is given to Toastman.
1,200
Print a single integer — the largest possible score.
standard output
PASSED
8deb6276ea183c0ea1193dc7754f652c
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.util.*; import java.lang.*; public class marlin { public static void main(String args[]) { int n=0,k=0; Scanner in= new Scanner(System.in); n=in.nextInt(); k=in.nextInt(); char r1[]=new char[n]; char r2[]=new char[n]; char r3...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
f0f87c3a493925b2ff5436d3efbcc114
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution ...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
6a1d2e7ff7c8d3875936304298c7059e
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution ...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
4d5bb696dad26439f59c08b0d5314db8
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.math.BigInteger; import java.util.*; public class Main { public static void main(String args[]) { Scanner sc =new Scanner(System.in); int a=sc.nextInt(); int b=sc.nextInt(); System.out.println("YES"); int x[][]=new int[4][a]; if(b%2==0){ ...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
32a265fd82eb055b1a6336e37b277d87
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.util.*; public class B { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); char[][] grid = new char[4][n]; if(k%2==0){ System.out.println("YES"); for(in...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
fde929b774d7ba91f69c5ac415d5db31
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Scanner; public class Solution { private static final boolean DEBUG = false; private static void solve(int columnCount, int hotel...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
a3cb9f34427373dd54efacc6b113dd3d
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.util.Scanner; public class Test{ public static void main(String[] args){ Scanner input = new Scanner(System.in); int shir = input.nextInt(); int hotels = input.nextInt(); if (hotels % 2 == 0 && hotels <= (shir - 2) * 2){ System.out.println("YES"...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
d502165ca5d8970cc69503d0a54d7eae
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.io.*; import java.util.*; public class Contest480B { static final int INF = (int) 1e8; static final int MOD = (int) 1e9 + 7; public static BlockReader input; public static PrintStream output; public static Debug debug; public static void main(String[] args) throws FileNotFoundExc...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
823dc61a4426d39147f22753a9acf465
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Main2 { private FastScanner scanner = new FastScanner(); public static void main(String[] args) { new Main2().solve(); } privat...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
dcc3f12845bc42abb6b7b1459a682da7
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class Solution{ public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); System.o...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
5694dc7d8fecf58a861057cdf655457a
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.sql.Array; import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); TaskB.solve(in, out); out.close(); } static class TaskA { ...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
33d074fa5192f2b81e43fc8045f4fade
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static boolean[][] field = new boolean[4][101]; public static void main(String[] args) { // Scanner reader = new Scanner(System.in); InputReader reader = new InputRe...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
3a0772aa0619d4f1d7b2ed47cbc8ab2f
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), k = sc.nextInt(); int r = 2, c = n - 2; boolean[][] mid = new boolean[r][c]; if(k > r * c){ System.out.println("NO"); return; } for(int i = 0; i < c; ++i){ ...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
0d869dc7ba6532a593159142e55d2b48
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; import java.math.RoundingMode; import java.util.*; public class Main { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); ...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
138d955e2810f178fe095fe79714eaba
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
// TODAY I WILL BECOME EXPERT ! import java.util.*; import java.math.*; import java.io.*; public class q_6 { static Scanner sc; public static void main(String[] args){ sc = new Scanner(System.in); int n = getInt(); int k = getInt(); int v = k; int x1 = 1; int c...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
c27440282ffae4b986039694f90583a7
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; //accidentally stabbed my hand while cutting avacado :( //still programming tho :) public class Marlin { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(), k=scan.nextInt(); char[][] a=new char[4][n]; for(char...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
6b0df9ac639d72b866f6aa4afc8864aa
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B2 { public static void main(String[] args) { FastScanner fs=new FastScanner(); int width=fs.nextInt()-2; int toPlace=fs.nextInt(); boolean[][] board=new boolean[widt...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
4ef68bb1611295cf58160e1a4029827b
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
/** * Date: 8 May, 2018 * Link: * * @author Prasad-Chaudhari * @email prasadc8897@gmail.com */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class newProgram4 { public static void main(String[] args) throws IOException { ...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
6a941904d0a2f8f4fa7c7b3f3ab9bb6f
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.util.*; /** * * @author comp */ public class Olimp { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); System.out.println...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
2d19bae5e7048f11ac59bbda5b570783
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.util.Arrays; import java.util.NoSuchElementException; public class Main { private static final PrintStream ps = System.out; private static final InputStream IS = System.in; private static final byte[] ...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
42bd551ab7aa23f8980f15000315f109
train_002.jsonl
1525791900
The city of Fishtopia can be imagined as a grid of $$$4$$$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $$$(1,1)$$$, people who stay there love fishing at the Tuna pond at the bottom-right cell $$$(4, n)$$$. The second village is located at $$$(4, 1)$$$ and its ...
256 megabytes
//980B //Marlin import java.util.Arrays; import java.util.Scanner; public class Marlin { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int hotels = sc.nextInt(); char[][] grid = new char[5][n + 1]; for(char[] x : g...
Java
["7 2", "5 3"]
1 second
["YES\n.......\n.#.....\n.#.....\n.......", "YES\n.....\n.###.\n.....\n....."]
null
Java 8
standard input
[ "constructive algorithms" ]
2669feb8200769869c4b2c29012059ed
The first line of input contain two integers, $$$n$$$ and $$$k$$$ ($$$3 \leq n \leq 99$$$, $$$0 \leq k \leq 2\times(n-2)$$$), $$$n$$$ is odd, the width of the city, and the number of hotels to be placed, respectively.
1,600
Print "YES", if it is possible to place all the hotels in a way that satisfies the problem statement, otherwise print "NO". If it is possible, print an extra $$$4$$$ lines that describe the city, each line should have $$$n$$$ characters, each of which is "#" if that cell has a hotel on it, or "." if not.
standard output
PASSED
7d1f2160144fd32ef54376e34c4b04be
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); int[] mas = new int[4]; int result, ost; for(int i = 0; i < t; i++) { mas[scan.nextInt() - 1]++; } ...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
751e761651505caa1b9c6f22c4f1f1b9
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.*; public class ClassA { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int loops = sc.nextInt(); int n1=0; int n2=0; int n3=0; int n4=0; for(int i=0;i<loops;i++) { int num = sc.nextInt(); if(num==1) { ...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
2c085fdcc7eccb8c1cdbcbd5185aceee
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.*; import java.lang.*; public class Main{ public static void main(String args[]){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int group[] = new int[n]; int count[] = new int[5]; for(int i = 0; i < n; i++){ group[i] = scan.nextI...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
7abc19edb3373f9c3b65b779aa88141a
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int x; int n1=0, n2=0, n3=0; int car = 0; for(int i=1; i<=n; i++) { ...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
678a0423f29beea2cdd3f8a7e7b15e5e
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int x; //JR Jahed int n1=0, n2=0, n3=0; int car = 0; for(int i=1; i<=...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
d4ef285987b72b12923916e8bdef463d
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.Scanner; public class main { public static void main(String[] args) { Scanner ssd = new Scanner(System.in); int count_1=0; int count_2=0; int count_3=0; int result = 0; int temp; int n = ssd.nextInt(); int array[] = new int[n];...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
996661bf46dfa71fde871ac97486aec3
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.Scanner; public class practice { public static void main(String[] args) { Scanner inp=new Scanner(System.in); int c1=0,c2=0,c3=0,c4=0; int n=inp.nextInt(),h; inp.nextLine(); while(n-->0) { h=inp.nextInt(); if(h==1)c1++; else if(h==2)c2++; else if(h==3)c3++; else c4++; } ...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
4e3511d5e2bc954bbd9ee7944355653c
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.Scanner; public class Taxi { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int temp; int counter = 0; int[] arr = new int[] { 0, 0, 0, 0, 0 }; for (int i = 0; i < n; i++) { temp = scanner.nextInt(); arr[temp]++; }...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
0de62572ab364d98a15a22c5aea069b4
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long n = scanner.nextLong(); int cnt = 0; int cntOf1 = 0; int cntOf2 = 0; int cntOf3 = 0; for (int i = 0; i < n; i++) { in...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
3f24ff75d09c2b6d940f040d5c967574
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.Scanner ; import java.util.Arrays ; public class Main { // it returns number of cars used // it modifies numbber of ones to those left // at the end no 3's will be left static int getRidOfThrees(int[] countOfNumbers) { int combined_one_three = Integer.min(countOfNumbers[3], cou...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
2fe09b898c512627614c53a73de79d0f
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] groups = new int[n]; for (int i = 0; i < n; ++i){ groups[i] = s.nextInt(); } ...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
1dc42fd38544191c31a8f94b5c71acee
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); StringTokenizer st = new StringTokenizer(input, " "); ...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
4daab9b00096583a1a44bd44fe8cf48d
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.Scanner; public class _01Taxi { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int nGroups = sc.nextInt(); int[] arr = new int[4]; int res = 0; while (nGroups > 0) { int next = sc.nextInt(); if (next ==...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
0de12b4c7b9cf723b5549c1f5a2cf0c2
train_002.jsonl
1330804800
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Polycarpus together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum nu...
256 megabytes
import java.util.Scanner; public class asss { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int arr[]=new int[n]; int once=0,twice=0,thrice=0,fours=0; for(int x=0;x<n;x++) { arr[x]=sc.nextInt(); ...
Java
["5\n1 2 4 3 3", "8\n2 3 4 4 2 1 3 1"]
3 seconds
["4", "5"]
NoteIn the first test we can sort the children into four cars like this: the third group (consisting of four children), the fourth group (consisting of three children), the fifth group (consisting of three children), the first and the second group (consisting of one and two children, correspondingly). There are oth...
Java 11
standard input
[ "implementation", "*special", "greedy" ]
371100da1b044ad500ac4e1c09fa8dcb
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.
1,100
Print the single number — the minimum number of taxis necessary to drive all children to Polycarpus.
standard output
PASSED
04fa03de7c7c08d05057ead0df79d8aa
train_002.jsonl
1455807600
IT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is that its pyramids will be not only quadrangular as in Egypt but also triangular and pentagonal. Of co...
64 megabytes
import java.io.*; import java.util.*; public class q { public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); double a = input.nextLong(), b = input.nextLong(), c = input.nextLong(); double res = 0; res += a*a*a / (6*Math.sqrt(2)); res += ...
Java
["2 5 3"]
0.5 seconds
["38.546168065709"]
null
Java 7
standard input
[ "geometry", "math" ]
560bc97986a355d461bd462c4e1ea9db
The only line of the input contains three integers l3, l4, l5 (1 ≤ l3, l4, l5 ≤ 1000) — the edge lengths of triangular, quadrangular and pentagonal pyramids correspondingly.
1,700
Output one number — the total volume of the pyramids. Absolute or relative error should not be greater than 10 - 9.
standard output
PASSED
5d8dd77362d8d95f1595a17974726548
train_002.jsonl
1455807600
IT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is that its pyramids will be not only quadrangular as in Egypt but also triangular and pentagonal. Of co...
64 megabytes
import java.util.*; public class q { public static void main(String[] args){ Scanner br = new Scanner(System.in); long l3= br.nextLong(); long l4 = br.nextLong(); long l5 = br.nextLong(); double ans = 0; //double h1 = Math.sqrt(l3*l3 - (.5*.5*l3*l3)); ans+=(Math.sqrt(2)*l3*l3*l3)/12.0; ans+=(...
Java
["2 5 3"]
0.5 seconds
["38.546168065709"]
null
Java 7
standard input
[ "geometry", "math" ]
560bc97986a355d461bd462c4e1ea9db
The only line of the input contains three integers l3, l4, l5 (1 ≤ l3, l4, l5 ≤ 1000) — the edge lengths of triangular, quadrangular and pentagonal pyramids correspondingly.
1,700
Output one number — the total volume of the pyramids. Absolute or relative error should not be greater than 10 - 9.
standard output
PASSED
dee06181dc070e46bdaa01eb58e3c10e
train_002.jsonl
1455807600
IT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is that its pyramids will be not only quadrangular as in Egypt but also triangular and pentagonal. Of co...
64 megabytes
import java.io.IOException; import java.util.*; public class Pyramids { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); int l1[] = sc.nextIntArray(3); double[] l2 = new double[l1.length]; for(int i = 0; i < l1.length; i++) { l2[i] = l1[i]; } double t...
Java
["2 5 3"]
0.5 seconds
["38.546168065709"]
null
Java 7
standard input
[ "geometry", "math" ]
560bc97986a355d461bd462c4e1ea9db
The only line of the input contains three integers l3, l4, l5 (1 ≤ l3, l4, l5 ≤ 1000) — the edge lengths of triangular, quadrangular and pentagonal pyramids correspondingly.
1,700
Output one number — the total volume of the pyramids. Absolute or relative error should not be greater than 10 - 9.
standard output
PASSED
b2a16362502bc5d34b3e06c86e36e5f6
train_002.jsonl
1455807600
IT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is that its pyramids will be not only quadrangular as in Egypt but also triangular and pentagonal. Of co...
64 megabytes
import java.io.*; import java.util.*; import java.math.*; public class BlitzQ { public static void main(String[] args) { Scanner in = new Scanner(System.in); double vol1 = volOfPyramid(in.nextInt(), 3); double vol2 = volOfPyramid(in.nextInt(), 4); double vol3 = volOfPyramid(in.nextInt(), 5); System.o...
Java
["2 5 3"]
0.5 seconds
["38.546168065709"]
null
Java 7
standard input
[ "geometry", "math" ]
560bc97986a355d461bd462c4e1ea9db
The only line of the input contains three integers l3, l4, l5 (1 ≤ l3, l4, l5 ≤ 1000) — the edge lengths of triangular, quadrangular and pentagonal pyramids correspondingly.
1,700
Output one number — the total volume of the pyramids. Absolute or relative error should not be greater than 10 - 9.
standard output
PASSED
f098f6e8960c445c1578b63f19000dd8
train_002.jsonl
1455807600
IT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is that its pyramids will be not only quadrangular as in Egypt but also triangular and pentagonal. Of co...
64 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.InputMismatchException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the to...
Java
["2 5 3"]
0.5 seconds
["38.546168065709"]
null
Java 7
standard input
[ "geometry", "math" ]
560bc97986a355d461bd462c4e1ea9db
The only line of the input contains three integers l3, l4, l5 (1 ≤ l3, l4, l5 ≤ 1000) — the edge lengths of triangular, quadrangular and pentagonal pyramids correspondingly.
1,700
Output one number — the total volume of the pyramids. Absolute or relative error should not be greater than 10 - 9.
standard output
PASSED
b9d0e12807823218cfc87db80b59d825
train_002.jsonl
1455807600
IT City administration has no rest because of the fame of the Pyramids in Egypt. There is a project of construction of pyramid complex near the city in the place called Emerald Walley. The distinction of the complex is that its pyramids will be not only quadrangular as in Egypt but also triangular and pentagonal. Of co...
64 megabytes
import java.awt.geom.AffineTransform; import java.awt.geom.Point2D; import java.io.*; import java.util.*; public class EECQ { private static StringTokenizer st; public static void nextLine(BufferedReader br) throws IOException { st = new StringTokenizer(br.readLine()); } public stati...
Java
["2 5 3"]
0.5 seconds
["38.546168065709"]
null
Java 7
standard input
[ "geometry", "math" ]
560bc97986a355d461bd462c4e1ea9db
The only line of the input contains three integers l3, l4, l5 (1 ≤ l3, l4, l5 ≤ 1000) — the edge lengths of triangular, quadrangular and pentagonal pyramids correspondingly.
1,700
Output one number — the total volume of the pyramids. Absolute or relative error should not be greater than 10 - 9.
standard output
PASSED
84c3b3a8690a7c0baec47eb2c36d8de8
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String [] a = new String [n]; for (int i =0; i<n; i++) { a[i] = sc.next(); } int blocks = 1; for (int i=1; i<n;...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
680c1ce2b4146e5b238aa805625b816a
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; public class Magnets { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int counter = 1; int oldG = 0; for (int i = 0; i < n; i++) { int g = input.nextInt(); if (i != 0...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
a517eff28b8721961e525c075909d800
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; public class Magnets { public static void main(String args[]){ int n,t,d=1; Scanner sc = new Scanner(System.in); n = sc.nextInt(); int a[]=new int[n]; for(int i=0;i<n;i++) { t = sc.nextInt(); a[i]=t; ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
76d7c7787b1f749e76a2bfe2566a0ac0
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n=scan.nextInt(); if(n==1){ System.out.println(1); System.exit(0); } int d=1; int present=0; int previous=0; for(int i=0;i<n;i++){ ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
31840d6ee69dca9297776f8706019898
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t= scan.nextInt(); int temp=0,count=0; for(int i=0;i<t;i++){ int n = scan.nextInt()...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
6416988c4aba9bfe2ee5a4ea40d59004
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class VF{ public static void main(String args[]){ try{ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); char c[]=new char[n]; for(int i=0;i<n;i++) c[i]=sc.next().charAt(0); ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
47ae4815a9b612f93574f67401cfd0c5
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n=0,result=0,max=0; n=sc.nextInt(); int count=0; int[] team=new int[n]; for(int i=0;i<n;i++) { team[i]=sc.nextInt(); ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
824dd446efb446015532bd17cd9792de
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.*; public class temp { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int len = sc.nextInt(); int[] data = new int[len]; for(int i=0; i<len; i++) data[i] = sc.nextInt(); int count =1; for(int i=0; i<len-1; i++) { if...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
27e8a6b7597b7090235b01af3c551122
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java .util.Scanner ; import java.util.*; public class cf2{ 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]=s.nextInt(); } int max =1; in...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
1cac1bf16b282b37654cabceaafa4014
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.LinkedHashMap; import java.util.Scanner; public class Magnets { public static void main(String[] args) { Scanner scan = new Scanner(System.in); LinkedHashMap<String,Integer> map = new LinkedHashMap<String,Integer>(); int n = scan.nextInt(); int groups = 1; String[] magnets = new String[...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 11
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output