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
77d235b914537e3e412469fd2871d3fa
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; public class Temp { public static void main(String args[]){ Scanner in = new Scanner(System.in); String s = in.nextLine(); Stack<Character> st = new Stack<Character>(); boolean del = true; while (del){ del = false; st.clear(); ...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
eecbe5ba5fe1c3f423859d78b6af76d3
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; import java.util.Stack; public class P81A { public static void main (String[] args){ Scanner scan = new Scanner(System.in); String str = scan.next(); Stack<Integer> stack = new Stack<Integer>(); for(int j = 0, i = 0; i < str.len...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
27a34dc6c5ff9496e5c223ea3a1d640c
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
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 P1 implements Runnable { private void solve() throws IOException { String s = nextToken(); StringBuilder...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
e9d483315833337d07f9746d93d50e6b
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.Scanner; public class A_Plugin { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String line = sc.nextLine(); char[] cs = line.toCharArray(); char[] out = new char[cs.length]; int tos = 0; fo...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
cd9951b0596353c721ab33a59fb4c079
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.LinkedList; import java.util.ListIterator; import java.util.Scanner; public class Plagin { public static void main(String[] s) { Scanner in = new Scanner(System.in); String data = in.next(); char [] result = data.toCharArray(); LinkedList<Character>list = new Li...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
413e1445284e7e4a7d732372f1006064
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.security.AccessControlException; import java.util.Iterator; import java.util.LinkedList; import ja...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
319f43ea12901f393a33245f51d20070
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.io.*; public class Plugin { public static void main(String[] args) throws IOException { InputStream in = new BufferedInputStream(System.in); OutputStream out = new BufferedOutputStream(System.out); int[] buffer = new int[2 * 10 * 10 * 10 * 10 * 10 + 3]; int pos = 0, readed; buffer[0] = 0; ...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
72f4e54029f8138d1b3e60aaf74d0e4f
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class p81A { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); solve(s); } static void solve(Strin...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
4d691044705ca623e4de8e4df19bcb18
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class p81AA { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); solve(s); } ...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
da0e86629ad01a3a165afea81aa55c90
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin=new Scanner(System.in); while(cin.hasNext()) { String s=cin.next(); char stack[]=new char[200005]; int stackn=0; for(int flag=0;flag<s.length();flag++) { if(stac...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
45684066d2c7deabc74ddb8370d8b593
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner in = new Scanner(System.in); StringBuffer sb = new StringBuffer(in.nextLine()); StringBuilder ans = new StringBuilder(); int x = 0; for (int i = 0; i < sb.length(); i++) { if...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
a1e2d036d9f95250ac0c840a97939b3d
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class LOL { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String cur = in.readLine(); ArrayDeque<Character> st = new ArrayDeque<Character>();...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
c70a3f57f512a0772afbf0165711a918
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class LOL { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String cur = in.readLine(); Deque<Character> st = new ArrayDeque<Character>(); ...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
d94e20b2c0e556c79d0a707bb11c5183
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class LOL { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String cur = in.readLine(); ArrayDeque<Character> st = new ArrayDeque<Character>();...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
a3472cadc17d2e24d396d135c4292b05
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class LOL { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String cur = in.readLine(); ArrayDeque<Character> st = new ArrayDeque<Character>();...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
b6520300e4c7c9921a10052f465b3328
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class LOL { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String cur = in.readLine(); ArrayDeque<Character> st = new ArrayDeque<Character>();...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
edc8e2b5f28e7071a265ac83d53d9b1b
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; import java.math.*; public class LOL { public static void main(String[] args) { Scanner in = new Scanner(System.in); String cur = in.nextLine(); Deque<Character> st = new ArrayDeque<Character>(); for (int i=0; i<cur.length(); i++) { st.push(cur.charAt(...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
3e8acbfc1254411d7828868dd7ae76f7
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class LOL { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String cur = in.readLine(); Deque<Character> st = new ArrayDeque<Character>(); ...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
dedc54975b6c78ca2f19fa064fcf81c6
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String in = sc.nextLine(); StringBuilder SB = new StringBuilder(); //LinkedList<String> all = new LinkedList<String>(); Stack<Character> stack = new Stack<Chara...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
0e010c67bdef0f4e1a2aa7d7e8016030
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.io.*; import java.util.*; public class main { public static void main(String[] args) throws Exception{ BufferedReader sc = new BufferedReader(new InputStreamReader(System.in)); String in = sc.readLine(); StringBuilder SB = new StringBuilder(); ArrayDeque<Character> AD = ...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
204f99f27423fad1a0db7480533d3f44
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.io.*; import java.util.*; public class main { public static void main(String[] args) throws Exception{ BufferedReader sc = new BufferedReader(new InputStreamReader(System.in)); String in = sc.readLine(); StringBuilder SB = new StringBuilder(); ArrayDeque<Character> AD = ...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
05d7bf7533b46d7e89999e4b7b83015e
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
/* * Hello! You are trying to hack my solution, are you? =) * Don't be afraid of the size, it's just a dump of useful methods like gcd, or n-th Fib number. * And I'm just too lazy to create a new .java for every task. * And if you were successful to hack my solution, please, send me this test as a message or to Abr...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
988a57f64acc6ec8ba01c91117309797
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; public class Main { public static void main(String[] s) { Scanner sc = new Scanner(System.in); Stack<Character> S = new Stack<Character>(); String Text = sc.next(); S.push(Text.charAt(0)); for (int i = 1; i < Text.length(); i++) { if (S.empty...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
32047dd77688da0e4cb049582d7c9db8
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.Scanner; public class A81 { public static void main(String ...args) { Scanner sc = new Scanner(System.in); char[] in = sc.next().trim().toCharArray(); StringBuffer res = new StringBuffer(); res.append(in[0]); for (int i=1; i<in.length; i...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
501bba5922679fca77c881eddb7a41ca
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.io.*; import java.util.*; public class plugin{ public static void main(String args[]) throws IOException{ BufferedReader lector = new BufferedReader(new InputStreamReader(System.in)); String a = lector.readLine(); Stack<Character> s = new Stack<Character>(); s.push(a.charAt(0)); for(int n = 1;n<a.length();n...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
adf40a6e06a7dffe1635e922449951f0
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
/** * Problem: * Source: ', Round * Link: * * @author Alexei Ostrovski */ import java.io.*; import java.util.Arrays; import java.util.Scanner; public class DoublesSolver { public static void main(String[] args) { //redirect input and output /*try { System.setIn(new FileInputStream("input.txt")); ...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
51aa00a0ed6d31ad34660bdd7241e9df
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; public class PlugIn { public static void main(String[] args) { Scanner input = new Scanner(System.in); StringBuilder s = new StringBuilder(input.next()); StringBuilder out = new StringBuilder(s.charAt(0) + ""); for(int i = 1; i<s.length(); i++) { ...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
008afcadd843c0cf37938776522d2507
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class A { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String s = in.readLine(); Stack<Character> ...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
d56c6673278a70ccf05e3319080a3a3e
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public StringBuilder plug(StringBuilder input){ int len = input.length(); int prev_len = 0; //if(len == 0) //return ""; while(prev_len - len != 0){ StringBuilder s = new StringBuilder(); int i = 0; while(i < len){ if(i+1 < len && input.c...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
f4feb9564fedfd905da2e699b08ea59a
train_000.jsonl
1304485200
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class ProblemA { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String line = reade...
Java
["hhoowaaaareyyoouu", "reallazy", "abacabaabacabaa"]
1 second
["wre", "rezy", "a"]
null
Java 6
standard input
[ "implementation" ]
26f1b8c3cb83603c904e1508df4067f4
The input data consists of a single line to be processed. The length of the line is from 1 to 2·105 characters inclusive. The string contains only lowercase Latin letters.
1,400
Print the given string after it is processed. It is guaranteed that the result will contain at least one character.
standard output
PASSED
0be05bbc47fc14768a007c495712c77a
train_000.jsonl
1458376500
The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: ti &lt; ti + 1 for each odd i &lt; n; ti &gt; ti + 1 for each even i &lt; n. For example, sequences (2, 8), (1, 5, 1) and (2, 5, 1, 100, 99, 120) are nice, while (1, 1), (1, 2, ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashSet; public class C { static int n, nums[]; static boolean valid(int pos) { if (pos > n) return true; if (pos % 2 == 0) { if (pos < n && nums[pos] <= nums[pos + 1]) return false; if (pos > 1 && nums[pos - 1] >= nu...
Java
["5\n2 8 4 7 7", "4\n200 150 100 50", "10\n3 2 1 4 1 4 1 4 1 4", "9\n1 2 3 4 5 6 7 8 9"]
2 seconds
["2", "1", "8", "0"]
NoteIn the first sample, there are two ways to get a nice sequence with one swap: Swap t2 = 8 with t4 = 7. Swap t1 = 2 with t5 = 7. In the second sample, there is only one way — Limak should swap t1 = 200 with t4 = 50.
Java 8
standard input
[ "implementation", "brute force" ]
e5b0e43beaca9baf428afec6ce454c50
The first line of the input contains one integer n (2 ≤ n ≤ 150 000) — the length of the sequence. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 150 000) — the initial sequence. It's guaranteed that the given sequence is not nice.
1,900
Print the number of ways to swap two elements exactly once in order to get a nice sequence.
standard output
PASSED
ca7a5467d4c4e8cfd92f93a74853c511
train_000.jsonl
1458376500
The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: ti &lt; ti + 1 for each odd i &lt; n; ti &gt; ti + 1 for each even i &lt; n. For example, sequences (2, 8), (1, 5, 1) and (2, 5, 1, 100, 99, 120) are nice, while (1, 1), (1, 2, ...
256 megabytes
import java.io.*; import java.util.*; public class Copy_4_of_CF { FastScanner in; PrintWriter out; class O implements Comparable<O> { int x, y; public O(int x, int y) { super(); this.x = Math.min(x, y); this.y = Math.max(x, y); } @Override public int compareTo(O o) { if (x != o.x) { ret...
Java
["5\n2 8 4 7 7", "4\n200 150 100 50", "10\n3 2 1 4 1 4 1 4 1 4", "9\n1 2 3 4 5 6 7 8 9"]
2 seconds
["2", "1", "8", "0"]
NoteIn the first sample, there are two ways to get a nice sequence with one swap: Swap t2 = 8 with t4 = 7. Swap t1 = 2 with t5 = 7. In the second sample, there is only one way — Limak should swap t1 = 200 with t4 = 50.
Java 8
standard input
[ "implementation", "brute force" ]
e5b0e43beaca9baf428afec6ce454c50
The first line of the input contains one integer n (2 ≤ n ≤ 150 000) — the length of the sequence. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 150 000) — the initial sequence. It's guaranteed that the given sequence is not nice.
1,900
Print the number of ways to swap two elements exactly once in order to get a nice sequence.
standard output
PASSED
efaf16645c8e9c5ac7d2e8b413345686
train_000.jsonl
1458376500
The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: ti &lt; ti + 1 for each odd i &lt; n; ti &gt; ti + 1 for each even i &lt; n. For example, sequences (2, 8), (1, 5, 1) and (2, 5, 1, 100, 99, 120) are nice, while (1, 1), (1, 2, ...
256 megabytes
/* * Code Author: Akshay Miterani * DA-IICT */ import java.io.*; import java.math.BigInteger; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.*; public class Main { static double eps=(double)1e-6; static long mod=(int)1e9+7; public ...
Java
["5\n2 8 4 7 7", "4\n200 150 100 50", "10\n3 2 1 4 1 4 1 4 1 4", "9\n1 2 3 4 5 6 7 8 9"]
2 seconds
["2", "1", "8", "0"]
NoteIn the first sample, there are two ways to get a nice sequence with one swap: Swap t2 = 8 with t4 = 7. Swap t1 = 2 with t5 = 7. In the second sample, there is only one way — Limak should swap t1 = 200 with t4 = 50.
Java 8
standard input
[ "implementation", "brute force" ]
e5b0e43beaca9baf428afec6ce454c50
The first line of the input contains one integer n (2 ≤ n ≤ 150 000) — the length of the sequence. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 150 000) — the initial sequence. It's guaranteed that the given sequence is not nice.
1,900
Print the number of ways to swap two elements exactly once in order to get a nice sequence.
standard output
PASSED
c309768105dfbcf6adf36596eb5aff83
train_000.jsonl
1458376500
The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: ti &lt; ti + 1 for each odd i &lt; n; ti &gt; ti + 1 for each even i &lt; n. For example, sequences (2, 8), (1, 5, 1) and (2, 5, 1, 100, 99, 120) are nice, while (1, 1), (1, 2, ...
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.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; public class BearAndUpDown { private static class Pair implements Comparable<Pair>...
Java
["5\n2 8 4 7 7", "4\n200 150 100 50", "10\n3 2 1 4 1 4 1 4 1 4", "9\n1 2 3 4 5 6 7 8 9"]
2 seconds
["2", "1", "8", "0"]
NoteIn the first sample, there are two ways to get a nice sequence with one swap: Swap t2 = 8 with t4 = 7. Swap t1 = 2 with t5 = 7. In the second sample, there is only one way — Limak should swap t1 = 200 with t4 = 50.
Java 8
standard input
[ "implementation", "brute force" ]
e5b0e43beaca9baf428afec6ce454c50
The first line of the input contains one integer n (2 ≤ n ≤ 150 000) — the length of the sequence. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 150 000) — the initial sequence. It's guaranteed that the given sequence is not nice.
1,900
Print the number of ways to swap two elements exactly once in order to get a nice sequence.
standard output
PASSED
be9530d8c5d8b67b1f67ea45b2a42cb1
train_000.jsonl
1458376500
The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: ti &lt; ti + 1 for each odd i &lt; n; ti &gt; ti + 1 for each even i &lt; n. For example, sequences (2, 8), (1, 5, 1) and (2, 5, 1, 100, 99, 120) are nice, while (1, 1), (1, 2, ...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.*; import java.util.function.*; import static java.lang.StrictMath.*; import static java.util.stream.Collectors.*; public class TaskC { private static final String INPUT_FILE = "input.txt"; private static final String ONLINE_JUDGE = "ONLINE_J...
Java
["5\n2 8 4 7 7", "4\n200 150 100 50", "10\n3 2 1 4 1 4 1 4 1 4", "9\n1 2 3 4 5 6 7 8 9"]
2 seconds
["2", "1", "8", "0"]
NoteIn the first sample, there are two ways to get a nice sequence with one swap: Swap t2 = 8 with t4 = 7. Swap t1 = 2 with t5 = 7. In the second sample, there is only one way — Limak should swap t1 = 200 with t4 = 50.
Java 8
standard input
[ "implementation", "brute force" ]
e5b0e43beaca9baf428afec6ce454c50
The first line of the input contains one integer n (2 ≤ n ≤ 150 000) — the length of the sequence. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 150 000) — the initial sequence. It's guaranteed that the given sequence is not nice.
1,900
Print the number of ways to swap two elements exactly once in order to get a nice sequence.
standard output
PASSED
7a38f3752220e4175eaad044ad386629
train_000.jsonl
1458376500
The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: ti &lt; ti + 1 for each odd i &lt; n; ti &gt; ti + 1 for each even i &lt; n. For example, sequences (2, 8), (1, 5, 1) and (2, 5, 1, 100, 99, 120) are nice, while (1, 1), (1, 2, ...
256 megabytes
import java.util.*; import java.io.*; public class TaskC { private FastScanner in; private PrintWriter out; public void solve() throws IOException { int n = in.nextInt(); int[] t = new int[n]; List<Integer> bad = new ArrayList<>(); Set<Integer> badSet = new TreeSet<>(); ...
Java
["5\n2 8 4 7 7", "4\n200 150 100 50", "10\n3 2 1 4 1 4 1 4 1 4", "9\n1 2 3 4 5 6 7 8 9"]
2 seconds
["2", "1", "8", "0"]
NoteIn the first sample, there are two ways to get a nice sequence with one swap: Swap t2 = 8 with t4 = 7. Swap t1 = 2 with t5 = 7. In the second sample, there is only one way — Limak should swap t1 = 200 with t4 = 50.
Java 8
standard input
[ "implementation", "brute force" ]
e5b0e43beaca9baf428afec6ce454c50
The first line of the input contains one integer n (2 ≤ n ≤ 150 000) — the length of the sequence. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 150 000) — the initial sequence. It's guaranteed that the given sequence is not nice.
1,900
Print the number of ways to swap two elements exactly once in order to get a nice sequence.
standard output
PASSED
89eb63aebae31647744ab5d40f764e28
train_000.jsonl
1458376500
The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: ti &lt; ti + 1 for each odd i &lt; n; ti &gt; ti + 1 for each even i &lt; n. For example, sequences (2, 8), (1, 5, 1) and (2, 5, 1, 100, 99, 120) are nice, while (1, 1), (1, 2, ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Iterator; import java.util.StringTokenizer; public class BearandUpDown { static HashSet<Integer> set; static int n; static int vals[]; static boolean...
Java
["5\n2 8 4 7 7", "4\n200 150 100 50", "10\n3 2 1 4 1 4 1 4 1 4", "9\n1 2 3 4 5 6 7 8 9"]
2 seconds
["2", "1", "8", "0"]
NoteIn the first sample, there are two ways to get a nice sequence with one swap: Swap t2 = 8 with t4 = 7. Swap t1 = 2 with t5 = 7. In the second sample, there is only one way — Limak should swap t1 = 200 with t4 = 50.
Java 8
standard input
[ "implementation", "brute force" ]
e5b0e43beaca9baf428afec6ce454c50
The first line of the input contains one integer n (2 ≤ n ≤ 150 000) — the length of the sequence. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 150 000) — the initial sequence. It's guaranteed that the given sequence is not nice.
1,900
Print the number of ways to swap two elements exactly once in order to get a nice sequence.
standard output
PASSED
917929b3efd287d8d0ba4a0f00e5ecc8
train_000.jsonl
1458376500
The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: ti &lt; ti + 1 for each odd i &lt; n; ti &gt; ti + 1 for each even i &lt; n. For example, sequences (2, 8), (1, 5, 1) and (2, 5, 1, 100, 99, 120) are nice, while (1, 1), (1, 2, ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Iterator; import java.util.StringTokenizer; public class BearandUpDown { static HashSet<Integer> set2; static int n; static int vals[]; static boolea...
Java
["5\n2 8 4 7 7", "4\n200 150 100 50", "10\n3 2 1 4 1 4 1 4 1 4", "9\n1 2 3 4 5 6 7 8 9"]
2 seconds
["2", "1", "8", "0"]
NoteIn the first sample, there are two ways to get a nice sequence with one swap: Swap t2 = 8 with t4 = 7. Swap t1 = 2 with t5 = 7. In the second sample, there is only one way — Limak should swap t1 = 200 with t4 = 50.
Java 8
standard input
[ "implementation", "brute force" ]
e5b0e43beaca9baf428afec6ce454c50
The first line of the input contains one integer n (2 ≤ n ≤ 150 000) — the length of the sequence. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 150 000) — the initial sequence. It's guaranteed that the given sequence is not nice.
1,900
Print the number of ways to swap two elements exactly once in order to get a nice sequence.
standard output
PASSED
9e81a11eed9465decaaa682a4920472b
train_000.jsonl
1458376500
The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: ti &lt; ti + 1 for each odd i &lt; n; ti &gt; ti + 1 for each even i &lt; n. For example, sequences (2, 8), (1, 5, 1) and (2, 5, 1, 100, 99, 120) are nice, while (1, 1), (1, 2, ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Iterator; import java.util.StringTokenizer; public class BearandUpDown { static HashSet<Integer> set2; static int n; static int vals[]; static boolea...
Java
["5\n2 8 4 7 7", "4\n200 150 100 50", "10\n3 2 1 4 1 4 1 4 1 4", "9\n1 2 3 4 5 6 7 8 9"]
2 seconds
["2", "1", "8", "0"]
NoteIn the first sample, there are two ways to get a nice sequence with one swap: Swap t2 = 8 with t4 = 7. Swap t1 = 2 with t5 = 7. In the second sample, there is only one way — Limak should swap t1 = 200 with t4 = 50.
Java 8
standard input
[ "implementation", "brute force" ]
e5b0e43beaca9baf428afec6ce454c50
The first line of the input contains one integer n (2 ≤ n ≤ 150 000) — the length of the sequence. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 150 000) — the initial sequence. It's guaranteed that the given sequence is not nice.
1,900
Print the number of ways to swap two elements exactly once in order to get a nice sequence.
standard output
PASSED
30142a01012c75069aa6b35558bcef48
train_000.jsonl
1458376500
The life goes up and down, just like nice sequences. Sequence t1, t2, ..., tn is called nice if the following two conditions are satisfied: ti &lt; ti + 1 for each odd i &lt; n; ti &gt; ti + 1 for each even i &lt; n. For example, sequences (2, 8), (1, 5, 1) and (2, 5, 1, 100, 99, 120) are nice, while (1, 1), (1, 2, ...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class TaskC { StringTokenizer st; BufferedReader in; PrintWriter out; public static void main(String[] args) throws IOException { TaskC taskC = new TaskC(); ...
Java
["5\n2 8 4 7 7", "4\n200 150 100 50", "10\n3 2 1 4 1 4 1 4 1 4", "9\n1 2 3 4 5 6 7 8 9"]
2 seconds
["2", "1", "8", "0"]
NoteIn the first sample, there are two ways to get a nice sequence with one swap: Swap t2 = 8 with t4 = 7. Swap t1 = 2 with t5 = 7. In the second sample, there is only one way — Limak should swap t1 = 200 with t4 = 50.
Java 8
standard input
[ "implementation", "brute force" ]
e5b0e43beaca9baf428afec6ce454c50
The first line of the input contains one integer n (2 ≤ n ≤ 150 000) — the length of the sequence. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 150 000) — the initial sequence. It's guaranteed that the given sequence is not nice.
1,900
Print the number of ways to swap two elements exactly once in order to get a nice sequence.
standard output
PASSED
4c4451eb58d0ffd568a23a2175eae3c5
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.BufferedInputStream; import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Objects; import java.util.Scanner; import java.util.stream.Collectors; import java.util.stream.IntStream; public class C { public static void main(String[] args) throws...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
94e71471456bac5b9af9b819a8d896e1
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.TreeSet; public class C { public static void main(String[] args) { FastScanner scan = new FastScanner(); PrintWrit...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
2f39145a9366a0fcf58d6deac315b157
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.math.*; import java.util.*; //import javafx.util.*; import java.io.*; public class Prg10 { PrintWriter pw = new PrintWriter(System.out); Random rnd = new Random(); int a; void run() { a = ni(); int b = ni(); int[][] m = new int[a][b], pstr = new int[a][b], pstl = n...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
54a3b43a9d016fd9c23f1645f7eea951
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package Round545; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Scanner; /** * * @aut...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
272807239061a25a89565921bbd67d2e
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.*; import java.util.*; public class C { public static void solution(BufferedReader reader, PrintWriter writer) throws IOException { In in = new In(reader); Out out = new Out(writer); int n = in.nextInt(); int m = in.nextInt(); int[][] grid = new in...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
c23e54a4c7f4b862a4ba6dbedfc9ef70
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.*; import java.util.*; public class informatics { public static void main(String[] args) throws IOException{ BufferedReader scan = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenize...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
b562a3f66dcd69f2a7bc532ed619d4c9
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.util.*; import java.io.*; public class C { public static void main(String[] args) { FastScanner scanner = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int N = scanner.nextInt(); int M = scanner.nextInt(); int[][] vals = new int[N][M]; ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
4171afe3f37a983d132f2206781a69b2
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.InputMismatchException; public class Q3 { public static void main(String[] args) { InputReader s = new InputReader(System.in); PrintWriter out = ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
f427d7891b74f4db0ca890aa42a9b680
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.Arrays; import java.util.Iterator; import java.util.Collection; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.i...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
ff3faa5f9ecdf59b9e63e262ff39eac0
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.Arrays; import java.util.Iterator; import java.util.Collection; import java.io.IOException; import java.io.InputStreamReader; import java.io.FileNotFoundExceptio...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
140c23aa6b0d0018b2bd77ad9c1f25f9
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.Arrays; import java.util.Iterator; import java.util.Collection; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.i...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
2c82f0de1a1b38a01cdfd1d8b9cb539c
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.StringTokenizer; public class Skyscrapers { static int[][] rowHighestValue; static int...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
a0c2957cf48553c08bcc505012b1f521
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.*; import java.util.*; import java.util.jar.JarEntry; public class Main { public static void main(String[] args) throws Exception { final FastScanner scanner = new FastScanner(System.in); int n = scanner.nextInt(); int m = scanner.nextInt(); int[][] a = new int[n][...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
5f619e83e7c92e7803c061365e0625b0
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import j...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
3017dc50f7d50fa38588d79998c0c9bb
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.FileInputStream; import java.util.Arra...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
8cb4730c51a9950f4ce1294af0994bc4
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Set; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.io.FileNotFoundException; import java.util.StringTokenizer; ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
6a204c10825b0a783fdfd59adab31d97
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import javafx.util.Pair; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.util.function.BiFunction; import java.util.function.BinaryOperator; import java.util.function.Function; import java.util.function.UnaryOperator; i...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
e97dbd74e6e08bd33d178fd70d72e1ba
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.util.Comparator; import java.io.InputStreamReader; import java.io.InputStream...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
74e36793e50545ae8be99270a0be4275
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.BufferedInputStream; 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.Arrays; import java.util.St...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
66853468902aa8396d7ec67055fd6a1f
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); long[][] hts = new long[n][m]; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
fe6295e36957eaf1a2ea08387b255cff
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 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 nC { public class Pair implements Comparable<Pair> { int x, i; @Override public int compareTo(Pair o) { // TODO Au...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
cb6412314d53f935a64c01b993f14210
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.*; import java.util.*; public class E1066 { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader inp = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
9e9307a9e659c3082623f354441f22a5
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.*; import java.util.*; public class E1066 { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader inp = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
ab6831005a3eac357dd7500ce3d8aee7
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.*; import java.math.BigDecimal; import java.util.*; public class scratch_25 { static class Reader { static BufferedReader reader; static StringTokenizer tokenizer; /** call this method to initialize reader for InputStream */ static void init(InputStream input) { ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
7973b6088449fdb1387fd649b9bff093
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.*; import java.util.*; public class A implements Runnable { FastReader scn; PrintWriter out; String INPUT = ""; void solve() { int n = scn.nextInt(), m = scn.nextInt(); int[][] arr = scn.next2DInt(n, m); int[][] row = new int[n][m]; int[] maxR = new int[n]; for (int i = 0; i < n; i++) { ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
b29113051bb9f160e9663d631595d3d6
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; import java.util.TreeSet; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
160c2a27228477b6aa3d47a0e50eee0a
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class Main { static class Pair implements Comparable<Pair> { int idx, value; public Pair(int idx, int value) { this.idx = idx; this....
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
3a83ad484b65b4aa0f22c7048e473476
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.*; import java.util.*; public class C { // ------------------------ public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); // ------------------------ int n=sc.nextInt(),m=sc.nextInt(); int[][]grid=new int[n][m];...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
50dbfdcd0e7b69fdd495989ed7e643c4
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.*; import java.util.*; public class Sol { static class FastReader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public FastReader() { ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
5f1db53588fa5a701ba45b8b869c14d0
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Comparator; ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
e9fae5b6c37689d35384321a72ce4788
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static final long MOD = 1_000_000_007, INF = 1_000_000_000_000_000_000L; static final int INf = 1_000_000_000; static FastReader reader; static PrintWriter writer; public static void main(String[] args) { ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
b1f5ec3b8d8121f929da2ca64d7d711b
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.util.*; import java.math.*; import java.io.*; public class c { public c() { FS scan = new FS(); PrintWriter out = new PrintWriter(System.out); int r = scan.nextInt(), c = scan.nextInt(); int[][] grid = new int[r][c]; int[][] maxrow = new int[r][c]; int[][] maxcol = new int[r][c]; int[][] pos...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
0d19b6e948e744124378d777ded16abc
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.stream.IntStream; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.UncheckedIOException; import java.util.stream.Stream; import ja...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
4939fb525c88af843d2ea07b95f23f61
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.*; import java.util.*; public class Source { static class FastScanner { private BufferedReader bufferedReader; private StringTokenizer stringTokenizer; public FastScanner(InputStream inputStream){ bufferedReader = new BufferedReader(new InputStreamReader(inputStre...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
e1e8347a16fe0498e9344f2e571ccc53
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.DataInputStream; import java.util.TreeMap; import java.util.Map; import java.io.IOException; import java.util.InputMismatchException; import java.util.TreeSet; import java.io.InputStream; /**...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
8fd4fe38a233d28b313decb3ecc2ab57
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.StringTokenizer; public class SkyScrapers { static class Pos { int nBig; ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
43cfb4a626c3cd93bc2c6741c84f4d74
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.SplittableRandom; import java.util.HashMap; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHel...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
f5a2112e525c444b72b2c4ef574fe89f
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util.StringTokenizer; import java.io.BufferedReader; impo...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
60fdce5c42dad67125361edcff95de94
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
/** * Date: 8 Mar, 2019 * Link: * * @author Prasad-Chaudhari * @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/ * @git: https://github.com/Prasad-Chaudhari */ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java....
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
339cf0c663d9c2b5ed2240a5150ab0e3
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
9a4906314f4e82cc7a7b5a1c049e109f
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException { FastS...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
ef4ae835ab09e99b7b9348d2b8c8e6dd
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Comparato...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
b7ac00a78d3bad363765d208e1220cf8
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author ...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
48c0abd3723076289bdc08221ab1ec92
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.BufferedReader; // import java.io.FileInputStream; // import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.ArrayList; import java.util.P...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
1708d0aaafa4ae56b4bd7308ae68c664
train_000.jsonl
1552035900
Dora loves adventures quite a lot. During some journey she encountered an amazing city, which is formed by $$$n$$$ streets along the Eastern direction and $$$m$$$ streets across the Southern direction. Naturally, this city has $$$nm$$$ intersections. At any intersection of $$$i$$$-th Eastern street and $$$j$$$-th South...
512 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
["2 3\n1 2 1\n2 1 2", "2 2\n1 2\n3 4"]
2 seconds
["2 2 2 \n2 2 2", "2 3 \n3 2"]
NoteIn the first example, it's not possible to decrease the maximum used height for the problem at any intersection, hence we don't have to change any heights.In the second example, the answers are as follows: For the intersection of the first line and the first column For the intersection of the first line and the ...
Java 8
standard input
[ "implementation", "sortings" ]
206861107f0c06d3c8e358a85b9ddd7f
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 1000$$$) — the number of streets going in the Eastern direction and the number of the streets going in Southern direction. Each of the following $$$n$$$ lines contains $$$m$$$ integers $$$a_{i,1}$$$, $$$a_{i,2}$$$, ..., $$$a_{i,m}$$$ ($$$1 \le ...
1,600
Print $$$n$$$ lines containing $$$m$$$ integers each. The integer $$$x_{i,j}$$$, located on $$$j$$$-th position inside the $$$i$$$-th line is an answer for the problem at the intersection of $$$i$$$-th Eastern street and $$$j$$$-th Southern street.
standard output
PASSED
f6b4d3ca59b1f3b83508e4f559acaeb2
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
//package contests.CF1012; import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); n = sc.nextInt(); ...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
b2539a04b655c5b073eb6a934655af7c
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
//package contests.CF1012; import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); n = sc.nextInt(); ...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
66c73a14bc9fc81c3d7c3628ee92efdb
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.InputStream; /**...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
b32a83735d5a347546ce0bf8cb889861
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.BufferedInputStream; import java.util.Date; import java.util.Scanner; /** * <a href='http://codeforces.com/problemset/problem/1012/C'>http://codeforces.com/problemset/problem/1012/C * dp * O(n ^ 2) TLE, don't know why */ public class Problem_1012C_Hills { public static void main(String[] args...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
b09330a39fad78cb27566a943fc12795
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
7577c600e24d70a27f79057f726887fb
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Arrays; public class C { static int dp[][][]; static int N; static int ar[]; static int low[]; static int dL[][]; static int dR[][]; static...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
2b6df60187e6837032128d97f4ea5fb8
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; public class c{ static long[] a; static long[][][] dp; static void solve(){ int n = ni()+2; a = new long[n]; a[0]=-100000; a[n-1]=-100000; for(int i=1;i<=n-2;++i)a[i]=ni(); dp = new long[2][...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
cdb4863a30c2b298d01bf66d4d2f39f0
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; //http://codeforces.com/problemset/problem/1012/C public class Hills { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); i...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
954fb44432bfb44e5be2dcca868e8c7d
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public clas...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
3fba5bfda9011ab0408b6f3de420937c
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.BufferedReader; // import java.io.FileInputStream; // import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; import static java.lang.Math.min; import static java.util.Arrays....
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
d6447b5e4b2f943e9dac0b39b86c8034
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.BufferedReader; // import java.io.FileInputStream; // import java.io.FileOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.StringTokenizer; import static java.lang.Math.min; import static java.util.Arrays....
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
d49aa2d5ac779d1dcec6120fd8c3b250
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main2 { public static class Gragh { public ArrayList<Edge>[] edges; public Gragh(int size) { this.edges = new ArrayList[size]; ...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
3ad9120fae0856f7229a24469f5a0463
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
//package round500; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class C { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); int...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
69cf033733cd1a13ace93754a8e1b170
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.*; import java.util.*; public class C implements Runnable{ public static void main (String[] args) {new Thread(null, new C(), "_cf", 1 << 28).start();} int n, oo = (int)2e9, a[], dp[][][][]; public void run() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); ...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output
PASSED
8e76590828ad6c9c5d8bf66a376b21a1
train_000.jsonl
1532938500
Welcome to Innopolis city. Throughout the whole year, Innopolis citizens suffer from everlasting city construction. From the window in your room, you see the sequence of n hills, where i-th of them has height ai. The Innopolis administration wants to build some houses on the hills. However, for the sake of city appeara...
512 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main { private static final long INF = 1234567890987654321L; public static void solve(FastIO io) { int N = io.nextInt(); int K = (N + 1) >> 1; long[] A = new long[N + 2]; for (int i = 1; i <= N; ++i) { A[i] = io.nextLong(); } ...
Java
["5\n1 1 1 1 1", "3\n1 2 3", "5\n1 2 3 2 2"]
1 second
["1 2 2", "0 2", "0 1 3"]
NoteIn the first example, to get at least one hill suitable for construction, one can decrease the second hill by one in one hour, then the sequence of heights becomes 1, 0, 1, 1, 1 and the first hill becomes suitable for construction.In the first example, to get at least two or at least three suitable hills, one can d...
Java 8
standard input
[ "dp" ]
9534b468bfb6126fc16b896532ced8c5
The first line of input contains the only integer n (1 ≤ n ≤ 5000)—the number of the hills in the sequence. Second line contains n integers ai (1 ≤ ai ≤ 100 000)—the heights of the hills in the sequence.
1,900
Print exactly numbers separated by spaces. The i-th printed number should be equal to the minimum number of hours required to level hills so it becomes possible to build i houses.
standard output