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 | 3bc2dbbeda33c8420c3b42af54fcb074 | train_000.jsonl | 1570957500 | There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw... | 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.Collection;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Queue;
import java.util.LinkedList;
import java.io.InputStream;
/*... | Java | ["6 1\nBWBBWW", "7 3\nWBWBWBW", "6 4\nBWBWBW"] | 1 second | ["WBBBWW", "WWWWWWW", "BWBWBW"] | NoteThe first example is described in the statement.The second example: "WBWBWBW" $$$\rightarrow$$$ "WWBWBWW" $$$\rightarrow$$$ "WWWBWWW" $$$\rightarrow$$$ "WWWWWWW". So all chips become white.The third example: "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 86d17fa4bac5edd0cc4b6bff1c9899b7 | The first line contains two integers $$$n$$$ and $$$k$$$ $$$(3 \le n \le 200\,000, 1 \le k \le 10^{9})$$$ β the number of chips and the number of iterations, respectively. The second line contains a string consisting of $$$n$$$ characters "W" and "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th chip is whit... | 2,300 | Print a string consisting of $$$n$$$ characters "W" and "B". If after $$$k$$$ iterations the $$$i$$$-th chip is white, then the $$$i$$$-th character should be "W". Otherwise the $$$i$$$-th character should be "B". | standard output | |
PASSED | 8bc37ba34f992d515fc90dcf177c081c | train_000.jsonl | 1570957500 | There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw... | 256 megabytes | import java.io.*;
import java.util.*;
public class F implements Runnable {
public static void main (String[] args) {new Thread(null, new F(), "_cf", 1 << 28).start();}
public void run() {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
System.err.println("");
int n = fs.n... | Java | ["6 1\nBWBBWW", "7 3\nWBWBWBW", "6 4\nBWBWBW"] | 1 second | ["WBBBWW", "WWWWWWW", "BWBWBW"] | NoteThe first example is described in the statement.The second example: "WBWBWBW" $$$\rightarrow$$$ "WWBWBWW" $$$\rightarrow$$$ "WWWBWWW" $$$\rightarrow$$$ "WWWWWWW". So all chips become white.The third example: "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 86d17fa4bac5edd0cc4b6bff1c9899b7 | The first line contains two integers $$$n$$$ and $$$k$$$ $$$(3 \le n \le 200\,000, 1 \le k \le 10^{9})$$$ β the number of chips and the number of iterations, respectively. The second line contains a string consisting of $$$n$$$ characters "W" and "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th chip is whit... | 2,300 | Print a string consisting of $$$n$$$ characters "W" and "B". If after $$$k$$$ iterations the $$$i$$$-th chip is white, then the $$$i$$$-th character should be "W". Otherwise the $$$i$$$-th character should be "B". | standard output | |
PASSED | 7bfa06b5d9941ac1bb4bb99ea062b787 | train_000.jsonl | 1570957500 | There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw... | 256 megabytes |
/**
* @author Juan Sebastian Beltran Rojas
* @mail jsbeltran.valhalla@gmail.com
* @veredict
* @url https://codeforces.com/problemset/problem/1244/F
* @category implementation
* @date 18/10/2019
**/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arr... | Java | ["6 1\nBWBBWW", "7 3\nWBWBWBW", "6 4\nBWBWBW"] | 1 second | ["WBBBWW", "WWWWWWW", "BWBWBW"] | NoteThe first example is described in the statement.The second example: "WBWBWBW" $$$\rightarrow$$$ "WWBWBWW" $$$\rightarrow$$$ "WWWBWWW" $$$\rightarrow$$$ "WWWWWWW". So all chips become white.The third example: "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 86d17fa4bac5edd0cc4b6bff1c9899b7 | The first line contains two integers $$$n$$$ and $$$k$$$ $$$(3 \le n \le 200\,000, 1 \le k \le 10^{9})$$$ β the number of chips and the number of iterations, respectively. The second line contains a string consisting of $$$n$$$ characters "W" and "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th chip is whit... | 2,300 | Print a string consisting of $$$n$$$ characters "W" and "B". If after $$$k$$$ iterations the $$$i$$$-th chip is white, then the $$$i$$$-th character should be "W". Otherwise the $$$i$$$-th character should be "B". | standard output | |
PASSED | fc10f9843b0ecae5dd045d083395a7db | train_000.jsonl | 1570957500 | There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw... | 256 megabytes | import java.util.*;
import java.io.*;
public class Chips {
static BufferedReader br;
static StringTokenizer tokenizer;
public static void main(String[] args) throws Exception {
br = new BufferedReader(new InputStreamReader(System.in));
int n = nextInt();
int k = nextInt();
boolean[] white = new boolean[n];... | Java | ["6 1\nBWBBWW", "7 3\nWBWBWBW", "6 4\nBWBWBW"] | 1 second | ["WBBBWW", "WWWWWWW", "BWBWBW"] | NoteThe first example is described in the statement.The second example: "WBWBWBW" $$$\rightarrow$$$ "WWBWBWW" $$$\rightarrow$$$ "WWWBWWW" $$$\rightarrow$$$ "WWWWWWW". So all chips become white.The third example: "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 86d17fa4bac5edd0cc4b6bff1c9899b7 | The first line contains two integers $$$n$$$ and $$$k$$$ $$$(3 \le n \le 200\,000, 1 \le k \le 10^{9})$$$ β the number of chips and the number of iterations, respectively. The second line contains a string consisting of $$$n$$$ characters "W" and "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th chip is whit... | 2,300 | Print a string consisting of $$$n$$$ characters "W" and "B". If after $$$k$$$ iterations the $$$i$$$-th chip is white, then the $$$i$$$-th character should be "W". Otherwise the $$$i$$$-th character should be "B". | standard output | |
PASSED | 0c5b6a6f3699a4b1ebc1ef70377ee2df | train_000.jsonl | 1570957500 | There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class Test {
public static void main(String[] args) throws Exception
{
// TODO Auto-generated method ... | Java | ["6 1\nBWBBWW", "7 3\nWBWBWBW", "6 4\nBWBWBW"] | 1 second | ["WBBBWW", "WWWWWWW", "BWBWBW"] | NoteThe first example is described in the statement.The second example: "WBWBWBW" $$$\rightarrow$$$ "WWBWBWW" $$$\rightarrow$$$ "WWWBWWW" $$$\rightarrow$$$ "WWWWWWW". So all chips become white.The third example: "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 86d17fa4bac5edd0cc4b6bff1c9899b7 | The first line contains two integers $$$n$$$ and $$$k$$$ $$$(3 \le n \le 200\,000, 1 \le k \le 10^{9})$$$ β the number of chips and the number of iterations, respectively. The second line contains a string consisting of $$$n$$$ characters "W" and "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th chip is whit... | 2,300 | Print a string consisting of $$$n$$$ characters "W" and "B". If after $$$k$$$ iterations the $$$i$$$-th chip is white, then the $$$i$$$-th character should be "W". Otherwise the $$$i$$$-th character should be "B". | standard output | |
PASSED | 85655cbb303e9b1a9820cc0dfdc1be58 | train_000.jsonl | 1570957500 | There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;
public class Main {
InputStream is;
PrintWriter out;
String INPUT = "";
pri... | Java | ["6 1\nBWBBWW", "7 3\nWBWBWBW", "6 4\nBWBWBW"] | 1 second | ["WBBBWW", "WWWWWWW", "BWBWBW"] | NoteThe first example is described in the statement.The second example: "WBWBWBW" $$$\rightarrow$$$ "WWBWBWW" $$$\rightarrow$$$ "WWWBWWW" $$$\rightarrow$$$ "WWWWWWW". So all chips become white.The third example: "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 86d17fa4bac5edd0cc4b6bff1c9899b7 | The first line contains two integers $$$n$$$ and $$$k$$$ $$$(3 \le n \le 200\,000, 1 \le k \le 10^{9})$$$ β the number of chips and the number of iterations, respectively. The second line contains a string consisting of $$$n$$$ characters "W" and "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th chip is whit... | 2,300 | Print a string consisting of $$$n$$$ characters "W" and "B". If after $$$k$$$ iterations the $$$i$$$-th chip is white, then the $$$i$$$-th character should be "W". Otherwise the $$$i$$$-th character should be "B". | standard output | |
PASSED | fb31599f776d2a173bd9f816e2b76c16 | train_000.jsonl | 1570957500 | There are $$$n$$$ chips arranged in a circle, numbered from $$$1$$$ to $$$n$$$. Initially each chip has black or white color. Then $$$k$$$ iterations occur. During each iteration the chips change their colors according to the following rules. For each chip $$$i$$$, three chips are considered: chip $$$i$$$ itself and tw... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run(){
out.println(work());
out.flush();
}
long mod=1000000007;
long gcd(long a,long b) {
return b==0?... | Java | ["6 1\nBWBBWW", "7 3\nWBWBWBW", "6 4\nBWBWBW"] | 1 second | ["WBBBWW", "WWWWWWW", "BWBWBW"] | NoteThe first example is described in the statement.The second example: "WBWBWBW" $$$\rightarrow$$$ "WWBWBWW" $$$\rightarrow$$$ "WWWBWWW" $$$\rightarrow$$$ "WWWWWWW". So all chips become white.The third example: "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ "BWBWBW" $$$\rightarrow$$$ "WBWBWB" $$$\rightarrow$$$ ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 86d17fa4bac5edd0cc4b6bff1c9899b7 | The first line contains two integers $$$n$$$ and $$$k$$$ $$$(3 \le n \le 200\,000, 1 \le k \le 10^{9})$$$ β the number of chips and the number of iterations, respectively. The second line contains a string consisting of $$$n$$$ characters "W" and "B". If the $$$i$$$-th character is "W", then the $$$i$$$-th chip is whit... | 2,300 | Print a string consisting of $$$n$$$ characters "W" and "B". If after $$$k$$$ iterations the $$$i$$$-th chip is white, then the $$$i$$$-th character should be "W". Otherwise the $$$i$$$-th character should be "B". | standard output | |
PASSED | ffcf72707630d7d95c45a251106ac181 | train_000.jsonl | 1582473900 | The biggest event of the year β Cota 2 world championship "The Innernational" is right around the corner. $$$2^n$$$ teams will compete in a double-elimination format (please, carefully read problem statement even if you know what is it) to identify the champion. Teams are numbered from $$$1$$$ to $$$2^n$$$ and will pla... | 512 megabytes | //package round623;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.Map;
public class B {
InputStream is;
PrintWriter out;
String INPU... | Java | ["3 1\n6", "3 3\n1 7 8", "3 4\n1 3 5 7"] | 2 seconds | ["6", "11", "14"] | NoteOn the image, each game of the championship is denoted with an English letter ($$$a$$$ to $$$n$$$). Winner of game $$$i$$$ is denoted as $$$Wi$$$, loser is denoted as $$$Li$$$. Teams you're a fan of are highlighted with red background.In the first example, team $$$6$$$ will play in 6 games if it looses the first up... | Java 11 | standard input | [
"dp",
"implementation"
] | 43501b998dbf4c4fef891a8591e32a42 | First input line has two integers $$$n, k$$$Β β $$$2^n$$$ teams are competing in the championship. You are a fan of $$$k$$$ teams ($$$2 \le n \le 17; 0 \le k \le 2^n$$$). Second input line has $$$k$$$ distinct integers $$$a_1, \ldots, a_k$$$Β β numbers of teams you're a fan of ($$$1 \le a_i \le 2^n$$$). | 2,500 | Output single integerΒ β maximal possible number of championship games that include teams you're fan of. | standard output | |
PASSED | 896255e651557b57fb9a9800a51d1496 | train_000.jsonl | 1413709200 | As you know, all the kids in Berland love playing with cubes. Little Petya has n towers consisting of cubes of the same size. Tower with number i consists of ai cubes stacked one on top of the other. Petya defines the instability of a set of towers as a value equal to the difference between the heights of the highest a... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.List;... | Java | ["3 2\n5 8 5", "3 4\n2 2 4", "5 3\n8 3 2 6 3"] | 1 second | ["0 2\n2 1\n2 3", "1 1\n3 2", "3 3\n1 3\n1 2\n1 3"] | NoteIn the first sample you need to move the cubes two times, from the second tower to the third one and from the second one to the first one. Then the heights of the towers are all the same and equal to 6. | Java 7 | standard input | [
"greedy",
"constructive algorithms",
"implementation",
"sortings",
"brute force"
] | 9cd42fb28173170a6cfa947cb31ead6d | The first line contains two space-separated positive integers n and k (1ββ€βnββ€β100, 1ββ€βkββ€β1000) β the number of towers in the given set and the maximum number of operations Petya can perform. The second line contains n space-separated positive integers ai (1ββ€βaiββ€β104) β the towers' initial heights. | 1,400 | In the first line print two space-separated non-negative integers s and m (mββ€βk). The first number is the value of the minimum possible instability that can be obtained after performing at most k operations, the second number is the number of operations needed for that. In the next m lines print the description of eac... | standard output | |
PASSED | 093905c4d2affa2458aec67190bdc28e | train_000.jsonl | 1413709200 | As you know, all the kids in Berland love playing with cubes. Little Petya has n towers consisting of cubes of the same size. Tower with number i consists of ai cubes stacked one on top of the other. Petya defines the instability of a set of towers as a value equal to the difference between the heights of the highest a... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.*;
import static java.lang.Long.*;
public class B274 {
int INF = Integer.MAX_VALUE / 100;
static Scanner sc = null;
static BufferedReader br = null;
static PrintStream out = null;
stati... | Java | ["3 2\n5 8 5", "3 4\n2 2 4", "5 3\n8 3 2 6 3"] | 1 second | ["0 2\n2 1\n2 3", "1 1\n3 2", "3 3\n1 3\n1 2\n1 3"] | NoteIn the first sample you need to move the cubes two times, from the second tower to the third one and from the second one to the first one. Then the heights of the towers are all the same and equal to 6. | Java 7 | standard input | [
"greedy",
"constructive algorithms",
"implementation",
"sortings",
"brute force"
] | 9cd42fb28173170a6cfa947cb31ead6d | The first line contains two space-separated positive integers n and k (1ββ€βnββ€β100, 1ββ€βkββ€β1000) β the number of towers in the given set and the maximum number of operations Petya can perform. The second line contains n space-separated positive integers ai (1ββ€βaiββ€β104) β the towers' initial heights. | 1,400 | In the first line print two space-separated non-negative integers s and m (mββ€βk). The first number is the value of the minimum possible instability that can be obtained after performing at most k operations, the second number is the number of operations needed for that. In the next m lines print the description of eac... | standard output | |
PASSED | f3ef419cedb50cd6cb3f54bacc80650c | train_000.jsonl | 1413709200 | As you know, all the kids in Berland love playing with cubes. Little Petya has n towers consisting of cubes of the same size. Tower with number i consists of ai cubes stacked one on top of the other. Petya defines the instability of a set of towers as a value equal to the difference between the heights of the highest a... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class B {
FastScanner in;
PrintWriter out;
public void run() {
try {
in = new FastScanner(new InputStreamReader(Sys... | Java | ["3 2\n5 8 5", "3 4\n2 2 4", "5 3\n8 3 2 6 3"] | 1 second | ["0 2\n2 1\n2 3", "1 1\n3 2", "3 3\n1 3\n1 2\n1 3"] | NoteIn the first sample you need to move the cubes two times, from the second tower to the third one and from the second one to the first one. Then the heights of the towers are all the same and equal to 6. | Java 7 | standard input | [
"greedy",
"constructive algorithms",
"implementation",
"sortings",
"brute force"
] | 9cd42fb28173170a6cfa947cb31ead6d | The first line contains two space-separated positive integers n and k (1ββ€βnββ€β100, 1ββ€βkββ€β1000) β the number of towers in the given set and the maximum number of operations Petya can perform. The second line contains n space-separated positive integers ai (1ββ€βaiββ€β104) β the towers' initial heights. | 1,400 | In the first line print two space-separated non-negative integers s and m (mββ€βk). The first number is the value of the minimum possible instability that can be obtained after performing at most k operations, the second number is the number of operations needed for that. In the next m lines print the description of eac... | standard output | |
PASSED | 3b855ac7d8b48dfed1bce766bc41fb80 | train_000.jsonl | 1413709200 | As you know, all the kids in Berland love playing with cubes. Little Petya has n towers consisting of cubes of the same size. Tower with number i consists of ai cubes stacked one on top of the other. Petya defines the instability of a set of towers as a value equal to the difference between the heights of the highest a... | 256 megabytes | import java.util.*;
public class B
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int[] t = new int[n];
PriorityQueue<Integer> max = new PriorityQueue<Integer>(1, new Rev());
Pr... | Java | ["3 2\n5 8 5", "3 4\n2 2 4", "5 3\n8 3 2 6 3"] | 1 second | ["0 2\n2 1\n2 3", "1 1\n3 2", "3 3\n1 3\n1 2\n1 3"] | NoteIn the first sample you need to move the cubes two times, from the second tower to the third one and from the second one to the first one. Then the heights of the towers are all the same and equal to 6. | Java 7 | standard input | [
"greedy",
"constructive algorithms",
"implementation",
"sortings",
"brute force"
] | 9cd42fb28173170a6cfa947cb31ead6d | The first line contains two space-separated positive integers n and k (1ββ€βnββ€β100, 1ββ€βkββ€β1000) β the number of towers in the given set and the maximum number of operations Petya can perform. The second line contains n space-separated positive integers ai (1ββ€βaiββ€β104) β the towers' initial heights. | 1,400 | In the first line print two space-separated non-negative integers s and m (mββ€βk). The first number is the value of the minimum possible instability that can be obtained after performing at most k operations, the second number is the number of operations needed for that. In the next m lines print the description of eac... | standard output | |
PASSED | c7a5853fef330c6ac06ba27997c7a03e | train_000.jsonl | 1413709200 | As you know, all the kids in Berland love playing with cubes. Little Petya has n towers consisting of cubes of the same size. Tower with number i consists of ai cubes stacked one on top of the other. Petya defines the instability of a set of towers as a value equal to the difference between the heights of the highest a... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
... | Java | ["3 2\n5 8 5", "3 4\n2 2 4", "5 3\n8 3 2 6 3"] | 1 second | ["0 2\n2 1\n2 3", "1 1\n3 2", "3 3\n1 3\n1 2\n1 3"] | NoteIn the first sample you need to move the cubes two times, from the second tower to the third one and from the second one to the first one. Then the heights of the towers are all the same and equal to 6. | Java 7 | standard input | [
"greedy",
"constructive algorithms",
"implementation",
"sortings",
"brute force"
] | 9cd42fb28173170a6cfa947cb31ead6d | The first line contains two space-separated positive integers n and k (1ββ€βnββ€β100, 1ββ€βkββ€β1000) β the number of towers in the given set and the maximum number of operations Petya can perform. The second line contains n space-separated positive integers ai (1ββ€βaiββ€β104) β the towers' initial heights. | 1,400 | In the first line print two space-separated non-negative integers s and m (mββ€βk). The first number is the value of the minimum possible instability that can be obtained after performing at most k operations, the second number is the number of operations needed for that. In the next m lines print the description of eac... | standard output | |
PASSED | 8a7e40369d8c75e17b4ae7978e8071aa | train_000.jsonl | 1413709200 | As you know, all the kids in Berland love playing with cubes. Little Petya has n towers consisting of cubes of the same size. Tower with number i consists of ai cubes stacked one on top of the other. Petya defines the instability of a set of towers as a value equal to the difference between the heights of the highest a... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List... | Java | ["3 2\n5 8 5", "3 4\n2 2 4", "5 3\n8 3 2 6 3"] | 1 second | ["0 2\n2 1\n2 3", "1 1\n3 2", "3 3\n1 3\n1 2\n1 3"] | NoteIn the first sample you need to move the cubes two times, from the second tower to the third one and from the second one to the first one. Then the heights of the towers are all the same and equal to 6. | Java 7 | standard input | [
"greedy",
"constructive algorithms",
"implementation",
"sortings",
"brute force"
] | 9cd42fb28173170a6cfa947cb31ead6d | The first line contains two space-separated positive integers n and k (1ββ€βnββ€β100, 1ββ€βkββ€β1000) β the number of towers in the given set and the maximum number of operations Petya can perform. The second line contains n space-separated positive integers ai (1ββ€βaiββ€β104) β the towers' initial heights. | 1,400 | In the first line print two space-separated non-negative integers s and m (mββ€βk). The first number is the value of the minimum possible instability that can be obtained after performing at most k operations, the second number is the number of operations needed for that. In the next m lines print the description of eac... | standard output | |
PASSED | 4cecb55f7767ac0c3a429686cf131d55 | train_000.jsonl | 1413709200 | As you know, all the kids in Berland love playing with cubes. Little Petya has n towers consisting of cubes of the same size. Tower with number i consists of ai cubes stacked one on top of the other. Petya defines the instability of a set of towers as a value equal to the difference between the heights of the highest a... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int towernum = sc.nextInt();
int openum = sc.nextInt();
int[] tower = new int[towernum];
for(int i = 0; i < towernum; i++){
tower[i] = sc.nextInt();
}
int[] answers = new int[openum];... | Java | ["3 2\n5 8 5", "3 4\n2 2 4", "5 3\n8 3 2 6 3"] | 1 second | ["0 2\n2 1\n2 3", "1 1\n3 2", "3 3\n1 3\n1 2\n1 3"] | NoteIn the first sample you need to move the cubes two times, from the second tower to the third one and from the second one to the first one. Then the heights of the towers are all the same and equal to 6. | Java 7 | standard input | [
"greedy",
"constructive algorithms",
"implementation",
"sortings",
"brute force"
] | 9cd42fb28173170a6cfa947cb31ead6d | The first line contains two space-separated positive integers n and k (1ββ€βnββ€β100, 1ββ€βkββ€β1000) β the number of towers in the given set and the maximum number of operations Petya can perform. The second line contains n space-separated positive integers ai (1ββ€βaiββ€β104) β the towers' initial heights. | 1,400 | In the first line print two space-separated non-negative integers s and m (mββ€βk). The first number is the value of the minimum possible instability that can be obtained after performing at most k operations, the second number is the number of operations needed for that. In the next m lines print the description of eac... | standard output | |
PASSED | 14d441f57ff46714992838c71768a171 | train_000.jsonl | 1413709200 | As you know, all the kids in Berland love playing with cubes. Little Petya has n towers consisting of cubes of the same size. Tower with number i consists of ai cubes stacked one on top of the other. Petya defines the instability of a set of towers as a value equal to the difference between the heights of the highest a... | 256 megabytes | import java.io.*;
import java.util.*;
public class Towers
{
public static void main(String[] args) throws IOException
{
//Locale.setDefault (Locale.US);
Reader in = new Reader();
StringBuilder out = new StringBuilder();
int n, k, j, min, c, max;
int[] a;
... | Java | ["3 2\n5 8 5", "3 4\n2 2 4", "5 3\n8 3 2 6 3"] | 1 second | ["0 2\n2 1\n2 3", "1 1\n3 2", "3 3\n1 3\n1 2\n1 3"] | NoteIn the first sample you need to move the cubes two times, from the second tower to the third one and from the second one to the first one. Then the heights of the towers are all the same and equal to 6. | Java 7 | standard input | [
"greedy",
"constructive algorithms",
"implementation",
"sortings",
"brute force"
] | 9cd42fb28173170a6cfa947cb31ead6d | The first line contains two space-separated positive integers n and k (1ββ€βnββ€β100, 1ββ€βkββ€β1000) β the number of towers in the given set and the maximum number of operations Petya can perform. The second line contains n space-separated positive integers ai (1ββ€βaiββ€β104) β the towers' initial heights. | 1,400 | In the first line print two space-separated non-negative integers s and m (mββ€βk). The first number is the value of the minimum possible instability that can be obtained after performing at most k operations, the second number is the number of operations needed for that. In the next m lines print the description of eac... | standard output | |
PASSED | 3f2bb879b2608cc6d544afa621eaa8fc | train_000.jsonl | 1529166900 | You need to execute several tasks, each associated with number of processors it needs, and the compute power it will consume.You have sufficient number of analog computers, each with enough processors for any task. Each computer can execute up to one task at a time, and no more than two tasks total. The first task can ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
FastScanner in;
PrintWriter out;
class O implements Comparable<O> {
int power, proc;
public O(int power, int proc) {
this.power = power;
this.proc = proc;
}
@Override
public int compare... | Java | ["6\n8 10 9 9 8 10\n1 1 1 1 1 1", "6\n8 10 9 9 8 10\n1 10 5 5 1 10"] | 1 second | ["9000", "1160"] | NoteIn the first example the best strategy is to run each task on a separate computer, getting average compute per processor during the first round equal to 9.In the second task it is best to run tasks with compute 10 and 9 on one computer, tasks with compute 10 and 8 on another, and tasks with compute 9 and 8 on the l... | Java 8 | standard input | [
"dp",
"binary search",
"greedy"
] | 8883f8124092ace99ce0309fb8a511aa | The first line contains a single integer n (1ββ€βnββ€β50) β the number of tasks. The second line contains n integers a1,βa2,β...,βan (1ββ€βaiββ€β108), where ai represents the amount of power required for the i-th task. The third line contains n integers b1,βb2,β...,βbn (1ββ€βbiββ€β100), where bi is the number of processors t... | 2,500 | Print a single integer value β the lowest threshold for which it is possible to assign all tasks in such a way that the system will not blow up after the first round of computation, multiplied by 1000 and rounded up. | standard output | |
PASSED | 558ae407e2fc1c4a9a659c2f5e628c49 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Arrays;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.Reader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 9a32dc18e23e1b3e2d17ef2f84c9a7df | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;
public class MysticalMosaic {
public static void main(String[] args) throws IOException {
Scanner sc=new Sc... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 25fd9a03a3c2f7283f42eb26d9dcd72b | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.io.Writer;
import java.io.OutputStreamWr... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | fc3681cfe8a4adad882e86dd65f31d2c | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes |
import java.util.*;
public class main {
public static void main(String[] args) {
Scanner i = new Scanner(System.in);
int n,m;
n = i.nextInt();
m= i.nextInt();
Vector<String>work = new Vector<String>(n);
Vector<Integer>rows = new Vector<Integer>();
Vector<Integer>cols = new Vector<Integer>();
for... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | f7a777f139c0bfddd73b68165071ca7e | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;
/**
* Built using CHelper p... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 3667ab836ec938e5c874a9b8d99aec28 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 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 = new P... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 565f1194a226f82f8be20dd2288ba2de | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class A {
public static void main(String[] args) throws IOException {
/**/
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
/*/
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | eff75f137a51dd590dd1dbbe0e0bf23a | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Random;
import java.util.StringTokenizer;
public class A {
static StringTokenizer st;
static BufferedReader br;... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 597bab48bc05d499173c4721e2e9fc17 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class A {
public static void main(String[] args) {
JS in = new JS();
int R = in.nextInt();
int C = in.nextInt();
int g[][] = new int[R][C];
for(int i = 0; i < R; i++) {
c... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | e2e80a930aef38661f1fb1da3adcc1bd | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.*;
import java.util.*;
public class pA {
void run() {
int hei = in.nextInt();
int wid = in.nextInt();
Set<String> set = new TreeSet<>();
for (int i = 0; i < hei; i++) {
set.add(in.next());
}
for (String s : set) {
for (String t : set) {
if (s.equals(t)) {
continue;
}
... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 8e919669031b0aee6d2bbc8d03d6e018 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.math.*;
import java.lang.*;
public class Main {
static String a[] = new String[55];
public static void main(String[] args) throws IOException {
FastReader fr = new FastReader();
PrintWriter pr = new PrintWriter(System.out);
int n = f... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 6f5fdd5274234326e530d522a0a106ff | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes |
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
int maxn=55;
static String ma[]=new String [55];
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner i... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | b8af6e535d1ccc505b9944c193a518c5 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.*;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class A {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 4090cf925d74dc6a6a7c5741f2a659ff | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collect... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 69807c697cb212daf841353488155f19 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collect... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 5e7dc44e83a2a9e61b3a0918c4176d8c | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class CF956A {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int r = in.nextIn... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 8347f459111c64f463c13fe2dcb0461a | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
public class A
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 54a54dac663d248fe9d500cf72be29fd | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static int mod = 1000000007;
static long inf = (long) 1e16;
static int n, m;
static ArrayList<Integer>[] ad;
static long[][][] memo;
static boolean f;
static boolean vis[];
s... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 1f2f890198c64661c159db8ebbb5ce91 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Bit... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 32e2e0a4f172dff9f1a87a3a93ce0682 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | //package com.company;
import java.io.*;
import java.util.*;
public class Main {
static long TIME_START, TIME_END;
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
// Scanner sc = new Scanner(new FileInputStream("Test.in"));
PrintWriter pw... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 2e195a982d0f78df7dfa7f20b32b3b07 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 9d3ab0b122a239dcd884b7f498baf830 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int n... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 899d76d0d7566363ce7486c59c735af3 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | //package round472;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class A {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni(), m = n... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | e829ee591a03d4cc6aa66a1feeba9692 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class A {
void submit() {
int n = nextInt();
int m = nextInt();
char[][] f = new char[n][];
for (int i = 0; i < n; i++) {
f[i] = nextToken().toCharArray();
}
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
if (A... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 484fa8e9416c69a7264038a27f9e0c82 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
import java.text.DecimalFormat;
import java.util.*;
public class Main {
private static int n,m;
private static char [] [] G;
private static boolean [] row,col;
private static LinkedList<Integer> R,C;
private static void dfs(... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 38ca9d40f73f3d33254ab6205a31008d | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes | import java.io.*;
import java.util.*;
public class cf2
{
public static void main (String[] args)
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int arr[][]=new int[n][m];
for(int i = 0 ;i<n;i++)
{
String s=sc.next();
for(int j=0;j<m;j++)
arr[i][j]=s.charA... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | b523bde9e12ebe2003de8b10701563c8 | train_000.jsonl | 1521905700 | There is a rectangular grid of n rows of m initially-white cells each.Arkady performed a certain number (possibly zero) of operations on it. In the i-th operation, a non-empty subset of rows Ri and a non-empty subset of columns Ci are chosen. For each row r in Ri and each column c in Ci, the intersection of row r and c... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.math.*;
public class utkarsh {
InputStream is;
PrintWriter out;
long maxl = (long) 4e18, mod = (long)1e9 + 7L;
void solve(){
//Enter code here utkarsh
int n = ni();
int m = ni();
char[][] s = new char[n][m];
... | Java | ["5 8\n.#.#..#.\n.....#..\n.#.#..#.\n#.#....#\n.....#..", "5 5\n..#..\n..#..\n#####\n..#..\n..#..", "5 9\n........#\n#........\n..##.#...\n.......#.\n....#.#.#"] | 1 second | ["Yes", "No", "No"] | NoteFor the first example, the desired setup can be produced by 3 operations, as is shown below. For the second example, the desired setup cannot be produced, since in order to colour the center row, the third row and all columns must be selected in one operation, but after that no column can be selected again, hence ... | Java 8 | standard input | [
"implementation",
"greedy"
] | ac718922461f3187d8b7587c360b05fc | The first line contains two space-separated integers n and m (1ββ€βn,βmββ€β50)Β β the number of rows and columns of the grid, respectively. Each of the following n lines contains a string of m characters, each being either '.' (denoting a white cell) or '#' (denoting a black cell), representing the desired setup. | 1,300 | If the given grid can be achieved by any valid sequence of operations, output "Yes"; otherwise output "No" (both without quotes). You can print each character in any case (upper or lower). | standard output | |
PASSED | 2997bc0592b229700d2cfb1894404277 | train_000.jsonl | 1315494000 | Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author... | Java | ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"] | 5 seconds | ["YES", "NO", "YES"] | null | Java 8 | standard input | [
"implementation",
"strings"
] | 0c9550a09f84de6bed529d007ccb4ae8 | The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that... | 1,600 | If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes). | standard output | |
PASSED | ad6b05f8fd7bf355180c1169728f097b | train_000.jsonl | 1315494000 | Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:... | 256 megabytes | import java.util.Scanner;
public class One113A {
public static void main(String args[]) {
String str = new Scanner(System.in).nextLine();
String words[] = str.split(" ");
String text[] = {(".*lios"), (".*liala"), (".*etr"),
(".*etra"), (".*initis"), (".*inites")};
boolean bool = true;
for(int i=0; i... | Java | ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"] | 5 seconds | ["YES", "NO", "YES"] | null | Java 8 | standard input | [
"implementation",
"strings"
] | 0c9550a09f84de6bed529d007ccb4ae8 | The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that... | 1,600 | If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes). | standard output | |
PASSED | 47dc994b66fa212cbbcc328f052f6f45 | train_000.jsonl | 1315494000 | Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:... | 256 megabytes | import java.util.Scanner;
import java.util.StringTokenizer;
public class GrammarLessons {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine();
s = s.replaceAll("\\b[a-z]*lios\\b", "_A");
s = s.replaceAll("\\b[a-z]*liala\\b", "_a");
s = s.replaceAll("\\... | Java | ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"] | 5 seconds | ["YES", "NO", "YES"] | null | Java 8 | standard input | [
"implementation",
"strings"
] | 0c9550a09f84de6bed529d007ccb4ae8 | The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that... | 1,600 | If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes). | standard output | |
PASSED | 2f450e98337bb74df92bdb6c0a502543 | train_000.jsonl | 1315494000 | Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class A113
{
public static int mod = 1000000007;
public static long INF = (1L << 60);
static FastS... | Java | ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"] | 5 seconds | ["YES", "NO", "YES"] | null | Java 8 | standard input | [
"implementation",
"strings"
] | 0c9550a09f84de6bed529d007ccb4ae8 | The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that... | 1,600 | If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes). | standard output | |
PASSED | 5a40ac23e040fc1303cb38bf6d1ef717 | train_000.jsonl | 1315494000 | Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:... | 256 megabytes | import java.util.Scanner;
public class Grammar_Lessons {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] statement = sc.nextLine().split(" ");
String ans;
if(isMasculine(statement[0]))
ans = isstatment(statement,0);
else
... | Java | ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"] | 5 seconds | ["YES", "NO", "YES"] | null | Java 8 | standard input | [
"implementation",
"strings"
] | 0c9550a09f84de6bed529d007ccb4ae8 | The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that... | 1,600 | If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes). | standard output | |
PASSED | 7fd6887f1ff035e7fd4dbeeb4f1c2b9d | train_000.jsonl | 1315494000 | Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class P113A {
public static void main(String[] args) {
InputStream inputStream = System.in;
Out... | Java | ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"] | 5 seconds | ["YES", "NO", "YES"] | null | Java 8 | standard input | [
"implementation",
"strings"
] | 0c9550a09f84de6bed529d007ccb4ae8 | The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that... | 1,600 | If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes). | standard output | |
PASSED | 5221fc5df124c3f12482b1f711868848 | train_000.jsonl | 1315494000 | Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
public static void main(String[] args) thro... | Java | ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"] | 5 seconds | ["YES", "NO", "YES"] | null | Java 8 | standard input | [
"implementation",
"strings"
] | 0c9550a09f84de6bed529d007ccb4ae8 | The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that... | 1,600 | If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes). | standard output | |
PASSED | f8334c151d531cb5b74d26127bb566ad | train_000.jsonl | 1315494000 | Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:... | 256 megabytes |
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Linked... | Java | ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"] | 5 seconds | ["YES", "NO", "YES"] | null | Java 8 | standard input | [
"implementation",
"strings"
] | 0c9550a09f84de6bed529d007ccb4ae8 | The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that... | 1,600 | If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes). | standard output | |
PASSED | e1c7ecb8d192c007fd89b4046b75eb88 | train_000.jsonl | 1315494000 | Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class ... | Java | ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"] | 5 seconds | ["YES", "NO", "YES"] | null | Java 8 | standard input | [
"implementation",
"strings"
] | 0c9550a09f84de6bed529d007ccb4ae8 | The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that... | 1,600 | If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes). | standard output | |
PASSED | 8d99170d4955ec46c7558db232490b8b | train_000.jsonl | 1315494000 | Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules: There are three parts of speech:... | 256 megabytes | import java.util.*;
public class GrammarLessons{
static class Parte{
public int tipo; // 0- Desconocido, 1- Adjetivo, 2- Sustantivo, 3- Verbo
public int genero; // 0- Desconocido, 1- Masculino, 2- Femenino
}
private static String[] sufijos;
public static void main(String args[]){
... | Java | ["petr", "etis atis animatis etis atis amatis", "nataliala kataliala vetra feinites"] | 5 seconds | ["YES", "NO", "YES"] | null | Java 8 | standard input | [
"implementation",
"strings"
] | 0c9550a09f84de6bed529d007ccb4ae8 | The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105. It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that... | 1,600 | If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes). | standard output | |
PASSED | f9f3cacf7cd58670f4e130ca8d00bde6 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.BufferedInputStream;
import java.util.Scanner;
public class _59B
{
public static void main(String[] args)
{
Scanner sc = new Scanner(new BufferedInputStream(System.in));
int n = sc.nextInt();
int k = sc.nextInt();
int[] a = new int[k+1];
for(int i=0;i<n;i++)
{
int x = sc.nextInt... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 0e4a84355d18aa357c285baa26516f63 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
*
* @author mohamed elshenawy
*/
public class Main {
public static void main(String... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | c62892ceeddf9004aab2b356795dc509 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | //package Div2_59;
import java.util.Arrays;
import java.util.Scanner;
public class B {
/**
* @param args
*/
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int k = s.nextInt();
int [] a = new int [n];
int c = 0;
for (int i = 0; i < a.length; i++)
... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 93df3f4c14d774f543371de2c11dd05e | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;
/*
* To change this template, choose Tools | Templates
... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 842f1ed2f4cfb91848b8d3603421efb7 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] argv) throws IOException{
new Main().run();
}
PrintWriter pw;
Scanner sc;
public void run() throws IOException{
boolean oj = true;//System.getProperty("ONLINE_JUDGE") != null;
Reader reader = oj ? new InputS... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | a3e791016ce4733debacea31d744f9c1 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.util.Scanner;
/**
* @author manu
*
*/
public class SettlersTraining {
/**
* @param args
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N, K;
N = in.nextInt();
K = in.nextInt();
int counter = 0;
int... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | aadf0ee0dc71c6ae406b4d9336304b03 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.*;
public class straining{
public static void main(String[] args){
Scanner br = new Scanner(System.in);
int n = br.nextInt();
int k = br.nextInt();
int[] nums = new int[k];
int[] temp = new int[k];
for(int i = 0;i<n;i++){
int c = br.nextInt()-1;
nums[c]++;
temp[c]++;
}
int cou... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | f6834b6ff31656e8b4d4b0ee4ec63177 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.Scanner;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n,i,k,temp=0;
n=in.nextInt();
k=in.nextInt();
int[] fl =new int[n+1];
for (i=0;i<n;i++)
fl[i]=in... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 66cd8b1b4d41d08fbd0e5a1768288acc | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.*;
public class test
{
public static void main(String[] args)
{
new test().run();
}
void run()
{
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int k = in.nextInt();
int[] count = new int[k];
int total ... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 4d5082f994d49d9bc858a2901d4067f2 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Round_59 {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
BufferedReader r = new Buffe... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 983231034ea997070f48d05761c62b7d | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main implements Runnable {
public void _main() throws IOException {
int n = nextInt();
int k = nextInt();
int[] am = new int[k + 1];
for (int i = 0; i < n; i++) {
int rank = nextInt();
++am[rank];
}
int res = 0;
while (am[k] < n) {
++res;
f... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 78bac910aad263dc4a4c35b43ccfd8d9 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
StreamTokenizer in;
PrintWriter out;
public static void main(String[] args) throws Exception {
new Solution().run();
}
public void run() throws Exception {
in = new StreamTokenizer (new BufferedReader(new InputStreamRe... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 61f02c8d41e92b21e314dc0264ade18d | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class B {
public void run() throws IOException{
Scanner s = new Scanner(new InputStreamReader(System.in));
int n = s.nextInt();
int k = s.nextInt();
int[] r = new int[n];
for... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | f682d6a4812b8d3c21440365eb7be3bf | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class B {
public void run() throws IOException{
Scanner s = new Scanner(new InputStreamReader(System.in));
int n = s.nextInt();
int k = s.nextInt();
int[] r = new int[n];
for... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 6479cd161fa470e6fe75ae7dfbe18d83 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args) throws IOException
{
new Main().run();
}
StreamTokenizer in;
PrintWriter out;
int nextInt() throws IOException
{
in.nextToken();
return (int)in.nval;
}
void run() throws IOEx... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 80920bb3fb4b2f4a96478dbfada81a08 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
public class Main {
private static StreamTokenizer in = new StreamTokenizer(new BufferedReader(
new InputStreamReader(System.in)));
private static PrintWriter out = new PrintWriter(System.o... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 49c405187c09bd4d802ec130b8b130f9 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Solution{
public static void main(String[]args){
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n, k;
n = in.nextInt();
k = in.nextInt();
int a[] = new int[n+1];
int ind[] = new int[k+1];
fo... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 19035d15ad36c667e12cd2dc98578c77 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author lazarov
*/
public class codeforces592 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | cef8ecac10030ede195a7b22f6cd5f52 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.LinkedList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
InputStream fin = System.in;
//fin = new FileInputStream("in.txt");
... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 9eff83b2c5410f3cf56e3384803cc0bb | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.util.Scanner;
/**
*
* @author epiZend
*/
public class TheSettlers {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 97fb4567a7f57fa8bb599879fb83f229 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;
import java.io.*;
public class Main {
void solve() {
int n = sc.nextInt();
int k = sc.nextInt();
int[] a = sc.nextIntArray(n);
int[] state = new int[k + 1];
int time = 0;
for (; ; ) {
int min = k;
for (int i = 0;... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 2aa170e893de7dd16454b4143c95d946 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.*;
public class B59 {
static InputStreamReader inp = new InputStreamReader(System.in);
static Buff... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 6a7292d4c9189c6e88d125d1012a5bdb | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.util.*;
public class TrainsOfSettlers {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int[] solder = new int[n+1];
solder[n] ... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | be58ddffc6e7f35e200c98d26ba6023e | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main (String[]ar)throws Exception{
BufferedReader read = new BufferedReader (new InputStreamReader(System.in));
HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
StringTokenizer st = new Stri... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | abf1ce7b2dadde241986b806a1b1bdde | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class Solution63B {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok =... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 02afb3e434d7a852ba11ac77897954cc | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int ans=0;
int array[]=new int[k+1];
for( int j = 0; j <n; j++)
... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | f64fc33a67e508a157daeee24e58b675 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by IntelliJ IDEA.
* User: piyushd
* Date: 2/28/11
* Time: 9:18 PM
* To change this template use File | Settings | File Templates.
*/
public class Task2 {
void run(){
int N = nextInt(), K = nextInt();
int[] num = new int[K];
for(int i = 0... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | de136f28be341b19463bf96997ac6f90 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by IntelliJ IDEA.
* User: piyushd
* Date: 2/28/11
* Time: 9:18 PM
* To change this template use File | Settings | File Templates.
*/
public class Task2 {
void run(){
int N = nextInt(), K = nextInt();
int[] num = new int[K];
for(int i = 0... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 38faa44f6502c02081fcb11a4d1fef13 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.Scanner;
public class R59d2_63B {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int k = s.nextInt();
int sum = 0;
int[] ranks = new int[n];
int[] newranks = new int[n];
for (int i = 0; i < n; i++) {
ranks[i] = s.nextInt();
}
wh... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 385beb0d43b2ba01e548b3e08e7f2470 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.Scanner;
public class p63b {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int k = in.nextInt();
int[] all= new int[k+1];
for (int i = 0; i < n; i++) {
all[in.nextInt()]++;
}... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 6ae7dd67a5f83301091ebc504aa88c20 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
public class r59_b {
static StringTokenizer st;... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | cd53bfe2a0082b93008f6d2b48b49bd7 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int k = in.nextInt();
i... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | d5d27b03020123e3c341ac5a15cd88b4 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.awt.Point;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | a834f6b7fac09852437c8d31e2361776 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
public class Main{
static class Run implements Runnable{
//TODO parameters
final boolean consoleIO = true;
final String inFile = "input.txt";
final String outF... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | b4a8e8fe6dc84bdda5f09d32ae5dbbfa | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.util.Scanner;
//package b;
public class Main
{
static Scanner sin =new Scanner(System.in);
public static void main(String[] args)
{
int cnt=0,n,k;
int a[]=new int[110];
n=sin.nextInt();
k=sin.nextInt();
a[n]=k;
for(int i=0;i<n;i++) a[i]=sin.next... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 04ee5d74384ec29d9f2de177766940de | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;
public class Main {
public static void main(String[] args) throws IOException {
new Thread(null, new Runnable() {
public voi... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 70ed52d38ae220838520abb902bbd529 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.Scanner;
public class SettlerTraining{
public static void main(String [] args){
Scanner input = new Scanner(System.in);
int tc = input.nextInt();
int max = input.nextInt();
int[] arr = new int [max];
boolean[] param = new boolean [max];
for(int i = 0;... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 0990fa8a3e453fb1b932fe393d226df7 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.*;
public class Train{
public static void main(String args[])throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer(br.readLine());
int i=0,j=0,n=Integer.parseInt(st.nextToken()),k=Integer.parseInt(st.nextToke... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 9abf34f508e9210f705400a46064be97 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class BetaRound59_B implements Runnable {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws IOException {
i... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 83c55cf9feec8262da05206a54cdefee | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes |
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class BetaRound59_B implements Runnable {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws IO... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 1d4026511034ebe6039d1ed714712c84 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.*;
import java.util.Scanner;
public class Main
{
public static void main(String args[]) throws Exception
{
Solution sol = new Solution();
sol.Run();
}
static public class Solution
{
void Solve(BufferedReader input, PrintStream output) throws Exception
{
Scanner scanner = new Scanner(inp... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 4021d9d3584e00f3dbec2fecca8ee34e | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.math.BigInteger;
import java.util.ArrayDeque;
public class Main {
private static StreamTokenizer in;
private static PrintWriter out;
private static BufferedReader inB;
... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | ac7b874d4fae2890c033766154abf3f2 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class PB {
public static void main(String[] args) {
PB m = new PB();
m.start();
}
private void start() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 6444853520a21538a1e4d029f9939360 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Main m = new Main();
m.start();
}
private void start() {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt(... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 28ff5acb8c8239e918aab50fa7bb5232 | train_000.jsonl | 1298908800 | In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly n soldiers. Within this task we can assume that the number of soldiers in the defense structure won't either inc... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class B {
public static void main(String[] args)throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = 0,k = 0;
String[]use = br.readLine... | Java | ["4 4\n1 2 2 3", "4 3\n1 1 1 1"] | 2 seconds | ["4", "5"] | NoteIn the first example the ranks will be raised in the following manner:1 2 2 3 βββ 2 2 3 4 βββ 2 3 4 4 βββ 3 4 4 4 βββ 4 4 4 4Thus totals to 4 training sessions that require 4 golden coins. | Java 6 | standard input | [
"implementation"
] | 3d6411d67c85f6293f1999ccff2cd8ba | The first line contains two integers n and k (1ββ€βn,βkββ€β100). They represent the number of soldiers and the number of different ranks correspondingly. The second line contains n numbers in the non-decreasing order. The i-th of them, ai, represents the rank of the i-th soldier in the defense building (1ββ€βiββ€βn, 1ββ€βai... | 1,200 | Print a single integer β the number of golden coins needed to raise all the soldiers to the maximal rank. | standard output | |
PASSED | 5d50a0b4580daf698e119b043914bb48 | train_000.jsonl | 1596810900 | Pinkie Pie has bought a bag of patty-cakes with different fillings! But it appeared that not all patty-cakes differ from one another with filling. In other words, the bag contains some patty-cakes with the same filling.Pinkie Pie eats the patty-cakes one-by-one. She likes having fun so she decided not to simply eat the... | 256 megabytes | import java.util.*;
import java.io.*;
public class MainClass
{
static int[] map;
static int[] map1;
static HashSet<Integer> h1;
static HashSet<Integer> h;
public static void main(String args[])throws IOException
{
Reader in = new Reader();
int t = in.nextInt();
StringBuil... | Java | ["4\n7\n1 7 1 6 4 4 6\n8\n1 1 4 6 4 6 4 7\n3\n3 3 3\n6\n2 5 2 3 1 4"] | 2 seconds | ["3\n2\n0\n4"] | NoteFor the first bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$6$$$, $$$4$$$, $$$7$$$, $$$1$$$, $$$6$$$, $$$4$$$ (in this way, the minimum distance is equal to $$$3$$$).For the second bag Pinkie Pie can eat the patty-cakes in the following order (by fillings): $$$1$$$, $$$4$$... | Java 8 | standard input | [
"constructive algorithms",
"sortings",
"greedy",
"math"
] | 9d480b3979a7c9789fd8247120f31f03 | The first line contains a single integer $$$T$$$ ($$$1 \le T \le 100$$$): the number of bags for which you need to solve the problem. The first line of each bag description contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$): the number of patty-cakes in it. The second line of the bag description contains $$$n$$... | 1,700 | For each bag print in separate line one single integer: the largest minimum distance between the eaten patty-cakes with the same filling amongst all possible orders of eating for that bag. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.