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
659584700e80f3e5e87c13609545655a
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.Random; import java.util.Scanner; public class CF178D2C implements CodeforcesSolver { long mod = 1000000007; CombinationNumberTableWithModular<Int64> cn = new...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
b5bd236ea94546687c6fe9e959dd84b2
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.Random; import java.util.Scanner; public class CF178D2C implements CodeforcesSolver { long M = 1000000007; CombinationNumberTableWithModular<Int64> cn = new C...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
be724b6f76fec186734b7cc8d647a8bb
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.Random; import java.util.Scanner; public class CF178D2C implements CodeforcesSolver { long M = 1000000007; CombinationNumberTableWithModular<Int64> cn = new Co...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
74f7e541fdc13f571b7b8f151895dfa2
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.io.OutputStream; import java.io.PrintWriter; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Mahmoud Aladdin */ public class Main { public static void main(String[] args) { InputStream inputS...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
5d68dad1fe942ca15f49aee64e9c7973
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.io.InputStream; import java.io.PrintStream; import java.util.Scanner; /** * @author Abhimanyu Singh * */ public class ShaassAndLights { static final int MOD = 1000000007; static int mod(int a) { return a % MOD; } static int mul(int a, int b) { long a1 = a % MOD; ...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
442aa04fb57d79081df0e683ddec1e96
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.io.IOException; import java.util.ArrayList; import java.util.InputMismatchException; public class ShaassAndLights { public static final int MOD = 1000000007; public static final long[] POW2 = new long[1001]; public static final long[][] COMBOS = computeCombinations(2001); static { POW2[0] = 1; for ...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
2ddc52d35f55ab3a5e3e1c4ad4898b10
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.io.*; import java.util.*; public class C { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; static final int MOD = 1000000007; void solve() throws IOException { int n = nextInt(); int m = nextInt(); boolean[] lit = new boolean[n]; for (int i = 0; i < m; i++) { in...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
f5dc199f6f905b4a2db2e12cdab2b1bc
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.util.*; import java.io.BufferedInputStream; import java.util.Arrays; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.CharArrayWriter; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream;...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
849a28a50965c60f2a8099ccde386637
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
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.Locale; import java.util.StringTokenizer; public class C { private static final long MOD = (long) (1e9 + 7.5); private long[][] calc(int n) { long[][...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
97a151e2906860578d23da8899107eae
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.util.Scanner; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Arrays; import java.math.BigDecimal; import java.io.BufferedWriter; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; i...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
a55f3446e809ecfa72e207ec7802135c
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.Arrays; import java.util.StringTokenizer; public class Main { static long pow(long base, int exp) { long res = 1; while(exp > 0) { if(exp % 2 == 1) res = res * base % mod; base = base...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
01111f5df0943d704cda138f0b5ae277
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.lang.Math.*; public class C { int INF = 1 << 28; //long INF = 1L << 62; double EPS = 1e-10; long MOD = (long)1e9+7; long cmb[][]; long pow[]; void run() { ...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
5ded51707f1fef5a2b2ed5a3af47bbff
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
/* Codeforces Template */ import java.io.*; import java.math.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.fill; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { static long initTime; static final Random rnd = new Random...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
4b23e68c067dfe5f3540a8b23c249550
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Contest178 { public static void main(String[] args) throws IOException { new Contest178().run(); } class Book { public int t; public int w; public Book(int _t, int _w) { t = _t; ...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
4721b0604dbe87363bf0bcb7dff91fc6
train_003.jsonl
1365348600
There are n lights aligned in a row. These lights are numbered 1 to n from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light on (this light should be switched off at that moment) if there's at least one adjacent light which is alrea...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchEx...
Java
["3 1\n1", "4 2\n1 4", "11 2\n4 8"]
1 second
["1", "2", "6720"]
null
Java 7
standard input
[ "combinatorics", "number theory" ]
14da0cdf2939c796704ec548f49efb87
The first line of the input contains two integers n and m where n is the number of lights in the sequence and m is the number of lights which are initially switched on, (1 ≤ n ≤ 1000, 1 ≤ m ≤ n). The second line contains m distinct integers, each between 1 to n inclusive, denoting the indices of lights which are initia...
1,900
In the only line of the output print the number of different possible ways to switch on all the lights modulo 1000000007 (109 + 7).
standard output
PASSED
ef811b4b0e367ef34a3c41f51c22ebd8
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.*; import java.io.*; public class cf605_3_4 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); int a[] = new int[n]; int left[] = new int[n]; int right[] ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
6f9d407a2f3d3a9902447f14f2e672a3
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.*; public class rc{ public static void main(String[] args) { Scanner sc = new Scanner(System.in) ; int n = sc.nextInt(); int[] arr = new int[n]; for(int i=0; i<n; i++) arr[i] = sc.nextInt(); int[] r = new int[n]; int[] l = new int[n]; r[0] = 1; l[n-1] = 1; ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
e82cc6c16c01179eb06281b8fd394d20
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class pair implements Comparable<pair>{ int x; int y; public pair(int x, int y){ this.x=x; this.y=y; } public int compareTo(pair p){ return (x-p.x==0)?y-p.y:x-p.x; }...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
91174f608172f72ab763d4d2c08a6c0e
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class pair implements Comparable<pair>{ int x; int y; public pair(int x, int y){ this.x=x; this.y=y; } public int compareTo(pair p){ return (x-p.x==0)?y-p.y:x-p.x; }...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
34bd9104d33b6f2cb6cf46b0c7daa01f
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.io.*; import java.util.*; public class practicing { static class tri { int l; int last; int beg; public tri(int m, int b,int ma) { l = m; last = ma; beg=b; } } static long pow(long n, int e) { long res = 1; ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
ae67a35fcf31832e18c62b45c89b28b3
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class cf1 { static long mod = (long)1e9 + 7; static long mod1 = 998244353; static FastScanner f; static PrintWriter pw = new PrintWriter(System.out); static Scanner S = new Scanner(System.in); static long x0; static long y...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
341bb27cacf2f749853a13105d57b454
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.Scanner; public class RemoveElement { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); int n = input.nextInt(); int[] a = new int[n]; for(int i=0;i<n;i++) a[i]=input.nextInt(); int[] start = new int[n]; int[]...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
13326ae8da1d3392694fdfbd866d4e5a
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.*; import java.io.*; import java.io.FileWriter; import java.math.BigInteger; import java.math.BigDecimal; // Solution public class Main { public static void main (String[] argv) { new Main(); } boolean test = false; final int[][] dirs8 = {{0,1}, {0,-1}, {-1,0}, {1,0}, ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
b58f0c85613dd203d762b52561a01344
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long arr[] = new long[n]; for(int i = 0; i < n; ++i) arr[i] = sc.nextLong(); int lis[] = new int[n]; int lds[] = ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
2d11fc32c13ce02f1d067df037d1d476
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Solution implements Runnable { public static void main(String args[]) throws Exception{new Thread(null, new Solution(),"Main",1<<27).start();} public void run() { InputReader i...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
825aa6faf1272dccab67617a1aed3a69
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class p1272D { public int n; public int[] a; public int[][][][] memo; public int[][][][] memo2; public int dp(int ind, int usedremove, int dominustwo, int isstart) { if(ind >= n) { return 0; } if(memo[ind][usedremove][dominustwo][isstart...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
b6b7500d5815d5445c847d4273ec2bbf
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
// package app; import java.util.Scanner; public class App3 { public static void main(String[] args) throws Exception { Scanner scanner = new Scanner(System.in); int arrayLength = scanner.nextInt(); scanner.nextLine(); int[] list = new int[arrayLength]; for (int i = 0; i...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
d3b52cbbd9d710519620c5f708896b2e
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } Str...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
3b6166fc316d64999a1c26c8c2349b98
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.*; import java.io.*; public class aaaaaaaaaaaaaaaa { public void run() throws Exception { FastReader file = new FastReader(); int times = file.nextInt(); ArrayList<Integer> x = new ArrayList(); for (int i = 0; i < times; i++) { x.add(file.nextInt()); } int[] prefix = new int[times], su...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
a5d9d8f1bbd35735953fe815756b3c4e
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; // written by luchy0120 public class Main { public static void main(String[] args) throws Exception { new Main().run(); } // int get_room(int i,int j){ // return i/3*3 + j/3; // } // int a[][] = new int[9][9]; // ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
ed50f3ed273510dc31eacc873a7a1dd9
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.*; import java.io.*; import java.text.*; public class D1272 { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < arr.length; i++) ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
0813cc0ef92244e695be0d803a144245
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; /* * 10 1 2 3 10 10 4 5 10 6 7 correct: 4 7 5 4 6 7 6 8 9 correct: 5 7 5 4 6 5 7 6 8 correct: 3 11 5 4 6 5 7 6 8 7 9 8 10 correct: 3 */ public class removeoneelement { public static void main(String[] args) throws IOException { FastScanner ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
ef38425a852acdca3c3b71fa49429a46
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class RemoveOneElement { public static void main(String[] args) { InputReader r = new InputReader(System.in); int n = r.nextI...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
59314ac94d4b9ca1db5cfccc0a63ae25
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.*; public final class Today { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int a[]=new int[n],temp=0; for(int i=0;i<n;i++) { a[i]=sc.nextInt(); } int incf[]=new int[n],max=1; incf[0]=1; for(int i=1;i<n;i++) { if(a[i]>a[i-1]) ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
bc5574e277cfe3d7461bb7054f949687
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int n = Integer.parseInt(br.readLine()); int[] a = new int[n]; Stri...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
5f9dea8f5c378dbaf5ed990fe6242cd7
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
// Don't place your source in a package import java.util.*; import java.lang.*; import java.io.*; import java.math.*; // Please name your class Main public class Main { static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); static int read() throws IO...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
75e43cd286918e22bd1b33859191066c
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.Scanner; // https://codeforces.com/problemset/problem/1272/D public class RemoveOneElement { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int arr[] = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } int dp[] = ne...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
98f0e053566d999b557329c8174709b6
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
// template halnix16 import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { static BufferedReader br; public static void main(String[] args) throws Exception { // write your code here br = new BufferedReader(new InputStreamReader(System.in)); long n = ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
589100ef46e5dc323a8953ece214e259
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
//package cf; import java.io.*; import java.util.*; import java.lang.*; import java.math.*; public class USACO { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter (System.out); ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
af5d293595f5c408437054310f69d240
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String ag[]) { Scanner sc=new Scanner(System.in); int i,j,k; int N=sc.nextInt(); int A[]=new int[N]; for(i=0;i<N;i++) A[i]=sc.nextInt(); int ans=0; int p...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
aecca88754a56fdfd182858436d92798
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.io.*; import java.util.*; /** * Only By Abhi_Valani */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintW...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
7b2a7ef3d19617d5221ce2999ac9e757
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
/** * Alipay.com Inc. Copyright (c) 2004-2020 All Rights Reserved. */ import java.util.Arrays; import java.util.Scanner; /** * Codeforces Round #605 (Div. 3) * 1272/D * * D. Remove One Element * * Examples * inputCopy * 5 * 1 2 5 3 4 * outputCopy * 4 * inputCopy * 2 * 1 2 * outputCopy * 2 * inputCo...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
f741f6b6f1c84651e55b5c2418037415
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 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.Stack; import java.util.StringTokenizer; public class TaskD { public static void main(String[] arg) { final FastScanner in = ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
21bafd990217e9064b02923768f8ec17
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.util.*; public class wha { public static void main(String args[]) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int arr[] = new int[n]; for(int i=0;i<n;i++) { arr[i] = input.nextInt(); } System.out.println(sol(arr,arr.length)); } static int sol(int arr[],int n) { i...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
9d392252deafb81332088edca6216bd1
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main{ public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); // String[] ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
3f50827a5183f2735c2abc59b5de379c
train_003.jsonl
1576157700
You are given an array $$$a$$$ consisting of $$$n$$$ integers.You can remove at most one element from this array. Thus, the final length of the array is $$$n-1$$$ or $$$n$$$.Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array.Recall that the contig...
256 megabytes
// Working program with FastReader import java.io.*; import java.util.*; public class C { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) ...
Java
["5\n1 2 5 3 4", "2\n1 2", "7\n6 5 4 3 2 4 3"]
2 seconds
["4", "2", "2"]
NoteIn the first example, you can delete $$$a_3=5$$$. Then the resulting array will be equal to $$$[1, 2, 3, 4]$$$ and the length of its largest increasing subarray will be equal to $$$4$$$.
Java 8
standard input
[ "dp", "brute force" ]
87b8dccfc0e5a63cd209c37cf8aebef0
The first line of the input contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,500
Print one integer — the maximum possible length of the strictly increasing contiguous subarray of the array $$$a$$$ after removing at most one element.
standard output
PASSED
10d30538c04ea0f47ed03073af8125d3
train_003.jsonl
1343662200
Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares), each cell has some number.At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.awt.geom.*; import static java.lang.Math.*; public class Solution implements Runnable { static final long MOD = 1000000007; int di [] = {0, 1}; int dj [] = {1, 0}; public void solve () throws Exception { int ...
Java
["1\n5", "2\n11 14\n16 12", "3\n25 16 25\n12 18 19\n11 13 8"]
4 seconds
["5", "53", "136"]
NoteComments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1). Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample: Fur...
Java 7
standard input
[ "dp" ]
45ccda0657d2b02540b1fc33745820b8
The first line contains a single integer (1 ≤ n ≤ 300). The next n lines contain n integers each: the j-th number on the i-th line ai, j ( - 1000 ≤ ai, j ≤ 1000) is the number written in the cell with coordinates (i, j).
2,000
On a single line print a single number — the answer to the problem.
standard output
PASSED
54b53341108770475b50b69e2b8479af
train_003.jsonl
1343662200
Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares), each cell has some number.At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with...
256 megabytes
import java.io.*; import java.util.*; public class cf214e { public static void main(String[] args) { FastIO in = new FastIO(), out = in; int n = in.nextInt(); int[][] v = new int[n][n]; for(int i=0; i<n; i++) for(int j=0; j<n; j++) v[i][j] = in.nextInt(); int numDiag = 2*n-1; int[][][] dp = n...
Java
["1\n5", "2\n11 14\n16 12", "3\n25 16 25\n12 18 19\n11 13 8"]
4 seconds
["5", "53", "136"]
NoteComments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1). Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample: Fur...
Java 7
standard input
[ "dp" ]
45ccda0657d2b02540b1fc33745820b8
The first line contains a single integer (1 ≤ n ≤ 300). The next n lines contain n integers each: the j-th number on the i-th line ai, j ( - 1000 ≤ ai, j ≤ 1000) is the number written in the cell with coordinates (i, j).
2,000
On a single line print a single number — the answer to the problem.
standard output
PASSED
9417b435f145a5341acf1190c403b36a
train_003.jsonl
1343662200
Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares), each cell has some number.At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.math.BigDecimal; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelp...
Java
["1\n5", "2\n11 14\n16 12", "3\n25 16 25\n12 18 19\n11 13 8"]
4 seconds
["5", "53", "136"]
NoteComments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1). Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample: Fur...
Java 7
standard input
[ "dp" ]
45ccda0657d2b02540b1fc33745820b8
The first line contains a single integer (1 ≤ n ≤ 300). The next n lines contain n integers each: the j-th number on the i-th line ai, j ( - 1000 ≤ ai, j ≤ 1000) is the number written in the cell with coordinates (i, j).
2,000
On a single line print a single number — the answer to the problem.
standard output
PASSED
d7eeaccaf45ba3b0afd688c47ab5a434
train_003.jsonl
1343662200
Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares), each cell has some number.At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.math.BigDecimal; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelp...
Java
["1\n5", "2\n11 14\n16 12", "3\n25 16 25\n12 18 19\n11 13 8"]
4 seconds
["5", "53", "136"]
NoteComments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1). Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample: Fur...
Java 7
standard input
[ "dp" ]
45ccda0657d2b02540b1fc33745820b8
The first line contains a single integer (1 ≤ n ≤ 300). The next n lines contain n integers each: the j-th number on the i-th line ai, j ( - 1000 ≤ ai, j ≤ 1000) is the number written in the cell with coordinates (i, j).
2,000
On a single line print a single number — the answer to the problem.
standard output
PASSED
4b67e51ae1cba0c42cf69ae71b41bde2
train_003.jsonl
1343662200
Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares), each cell has some number.At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.math.BigDecimal; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.math.BigInteger; import java.io.InputStream; /** * Built using CHelp...
Java
["1\n5", "2\n11 14\n16 12", "3\n25 16 25\n12 18 19\n11 13 8"]
4 seconds
["5", "53", "136"]
NoteComments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1). Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample: Fur...
Java 7
standard input
[ "dp" ]
45ccda0657d2b02540b1fc33745820b8
The first line contains a single integer (1 ≤ n ≤ 300). The next n lines contain n integers each: the j-th number on the i-th line ai, j ( - 1000 ≤ ai, j ≤ 1000) is the number written in the cell with coordinates (i, j).
2,000
On a single line print a single number — the answer to the problem.
standard output
PASSED
353b12fc6693cb49e5d2558333ee1371
train_003.jsonl
1343662200
Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares), each cell has some number.At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.awt.geom.*; import static java.lang.Math.*; public class Solution implements Runnable { static final long MOD = 1000000007; int di [] = {0, 1}; int dj [] = {1, 0}; public void solve () throws Exception { int n = nextInt(); int a [...
Java
["1\n5", "2\n11 14\n16 12", "3\n25 16 25\n12 18 19\n11 13 8"]
4 seconds
["5", "53", "136"]
NoteComments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1). Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample: Fur...
Java 7
standard input
[ "dp" ]
45ccda0657d2b02540b1fc33745820b8
The first line contains a single integer (1 ≤ n ≤ 300). The next n lines contain n integers each: the j-th number on the i-th line ai, j ( - 1000 ≤ ai, j ≤ 1000) is the number written in the cell with coordinates (i, j).
2,000
On a single line print a single number — the answer to the problem.
standard output
PASSED
040c7cb5537f934f68504e83635cc6d1
train_003.jsonl
1343662200
Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares), each cell has some number.At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class R131qCRelayRace { static int n; static int a[][]; static int dp[][][]; static int oo = (int)(1e9); public static void main(String args[] ) throws Exception { Buff...
Java
["1\n5", "2\n11 14\n16 12", "3\n25 16 25\n12 18 19\n11 13 8"]
4 seconds
["5", "53", "136"]
NoteComments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1). Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample: Fur...
Java 7
standard input
[ "dp" ]
45ccda0657d2b02540b1fc33745820b8
The first line contains a single integer (1 ≤ n ≤ 300). The next n lines contain n integers each: the j-th number on the i-th line ai, j ( - 1000 ≤ ai, j ≤ 1000) is the number written in the cell with coordinates (i, j).
2,000
On a single line print a single number — the answer to the problem.
standard output
PASSED
f2603f2ef839d071a30306e0bc5e9147
train_003.jsonl
1343662200
Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares), each cell has some number.At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with...
256 megabytes
import java.io.*; import java.util.*; public class c { static int n; static int[][] as; static int oo = -999999999; public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); n = input.nextInt(); as = new int[n][n]; for(int i = 0; i<n; i++) ...
Java
["1\n5", "2\n11 14\n16 12", "3\n25 16 25\n12 18 19\n11 13 8"]
4 seconds
["5", "53", "136"]
NoteComments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1). Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample: Fur...
Java 7
standard input
[ "dp" ]
45ccda0657d2b02540b1fc33745820b8
The first line contains a single integer (1 ≤ n ≤ 300). The next n lines contain n integers each: the j-th number on the i-th line ai, j ( - 1000 ≤ ai, j ≤ 1000) is the number written in the cell with coordinates (i, j).
2,000
On a single line print a single number — the answer to the problem.
standard output
PASSED
b7cda26348708b7ede30d939a3a8085e
train_003.jsonl
1343662200
Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares), each cell has some number.At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with...
256 megabytes
import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.Locale; import java.io.OutputStream; import java.util.RandomAccess; import java.io.PrintWriter; import java.util.AbstractList; import java.io.Writer; import java.util.Collection; import java.util.List; import java.io.IOException; import ...
Java
["1\n5", "2\n11 14\n16 12", "3\n25 16 25\n12 18 19\n11 13 8"]
4 seconds
["5", "53", "136"]
NoteComments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1). Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample: Fur...
Java 7
standard input
[ "dp" ]
45ccda0657d2b02540b1fc33745820b8
The first line contains a single integer (1 ≤ n ≤ 300). The next n lines contain n integers each: the j-th number on the i-th line ai, j ( - 1000 ≤ ai, j ≤ 1000) is the number written in the cell with coordinates (i, j).
2,000
On a single line print a single number — the answer to the problem.
standard output
PASSED
c0896bfa7bea3b749d7b5ea27442a59e
train_003.jsonl
1343662200
Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares), each cell has some number.At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with...
256 megabytes
import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.Locale; import java.io.OutputStream; import java.util.RandomAccess; import java.io.PrintWriter; import java.util.AbstractList; import java.io.Writer; import java.util.Collection; import java.util.List; import java.io.IOException; import ...
Java
["1\n5", "2\n11 14\n16 12", "3\n25 16 25\n12 18 19\n11 13 8"]
4 seconds
["5", "53", "136"]
NoteComments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1). Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample: Fur...
Java 7
standard input
[ "dp" ]
45ccda0657d2b02540b1fc33745820b8
The first line contains a single integer (1 ≤ n ≤ 300). The next n lines contain n integers each: the j-th number on the i-th line ai, j ( - 1000 ≤ ai, j ≤ 1000) is the number written in the cell with coordinates (i, j).
2,000
On a single line print a single number — the answer to the problem.
standard output
PASSED
b22bb804e153a2ff1551dc7524e63cda
train_003.jsonl
1343662200
Furik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares), each cell has some number.At the beginning of the race Furik stands in a cell with coordinates (1, 1), and Rubik stands in a cell with...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class CodeG { static class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next...
Java
["1\n5", "2\n11 14\n16 12", "3\n25 16 25\n12 18 19\n11 13 8"]
4 seconds
["5", "53", "136"]
NoteComments to the second sample: The profitable path for Furik is: (1, 1), (1, 2), (2, 2), and for Rubik: (2, 2), (2, 1), (1, 1). Comments to the third sample: The optimal path for Furik is: (1, 1), (1, 2), (1, 3), (2, 3), (3, 3), and for Rubik: (3, 3), (3, 2), (2, 2), (2, 1), (1, 1). The figure to the sample: Fur...
Java 7
standard input
[ "dp" ]
45ccda0657d2b02540b1fc33745820b8
The first line contains a single integer (1 ≤ n ≤ 300). The next n lines contain n integers each: the j-th number on the i-th line ai, j ( - 1000 ≤ ai, j ≤ 1000) is the number written in the cell with coordinates (i, j).
2,000
On a single line print a single number — the answer to the problem.
standard output
PASSED
248612b68e3e2046954aaafc2609a3f7
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class B { public static void main(String[] args) { Scanner inputt = new Scanner(System.in); int num = inputt.nextInt(); int a = inputt.nextInt(); int b = inputt.nextInt(); double[] angles = new double[num]; for (int i = 0; i < num; i++) { in...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
4246a25b5bb6b310f882474975558ad6
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.io.IOException; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchException; /* * 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. */ /** * * @...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
4144b3dec828b8651b273b895d853d61
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Comparator; import java.util.HashSet; import java.util.List; public class Main { public static void main(String...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
3b44535fc573052aa448e361e42524c6
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelpe...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
88ac566873cd9a336dbecdbde33ff00a
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.util.*; public class Laser { static HashMap<Double, Integer> key = new HashMap<Double, Integer>(); static int res = 0; static boolean inf = false; static boolean zer = false; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a = sc.nextInt()...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
5b09d102c72adcc59d5695039d3c816c
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashSet; import java.util.StringTokenizer; public class TB { public static void main(String[] args) { FastScanner in=new FastScanner(); int i,n,x0,y0,x,y; double k; n=in.nextInt(); x0=in.nextInt(); y0=in.nextInt(); HashSet...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
8015264acd3f81e0b02b152ff028e202
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws NumberFormatException, IOException { Stdin in = new Stdin(); P...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
6c083eaa5094e62d522edc7baf82b7cc
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class MainB { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int n = sc.nextInt(); long[][] target = new long[n][2]; long nx = s...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
d86581ecab711c50d32c2ccf15ab5c05
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; public class MainB { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int n = sc.nextInt(); int x0 = sc.nextInt()...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
2b67670336335a5069ddb47834a0a854
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import static java.lang.System.in; import static java.lang.System.out; import java.io.*; import java.util.*; public class B514 { /* * You can generate hash object with string by concatenating integers. * ToDO hashcode of 3 integers. */ static final double EPS = 1e-10; static final double INF = 1 << 31; stat...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
63d79bffafa0f9e7eafdec6ba467a4cf
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import static java.lang.System.in; import static java.lang.System.out; import java.io.*; import java.util.*; public class B514 { static final double EPS = 1e-10; static final double INF = 1 << 31; static final double PI = Math.PI; public static Scanner sc = new Scanner(in); StringBuilder sb = new StringBuilder(...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
fd74301fe01c2c03b6b8307e23468565
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.util.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] in = br.readL...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
14ea1059a9e968f5685705bee223b372
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigI...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
ee36acf28a2eb743f683a17f6b37f601
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; //package C291Div2; public class B { public static void main(String[] args) { InputStream inp...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
4b0b5684bf110190ea973ce4839616aa
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.util.ArrayList; import java.util.InputMismatchException; import java.util.Locale; import java.util.Scanner; import java.util.regex.Pattern; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Iterator; import java.util.NoSuchElementExc...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
d4736553654ddb5bf61c6e35c76d27b4
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.io.IOException; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.Hashtable; import java.util.InputMismatchException;...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
ddafd2f33a05c4d07cf6013a58021b40
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x0= sc.nextInt(); int y0=sc.nextInt(); int x=0,y=0; Set<Double> slopeSet = new HashSet<>(); Double...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
c77d4af0ab58e4aac282f449d621d8ee
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.util.HashSet; import java.util.Scanner; public class Main { private static double x,y; private static Double k=0d,c=0d; private static boolean vertical=false,lastWasVertical=false; public static void main(String[] args) { Scanner S=new Scanner(System.in); Integer n=S.nextInt(...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
261113a12de0816a562175148d49a837
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n =in.nextInt(); int x= in.nextInt(); int y=in.nextInt(); Set<Do...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
88e850682eb3c97fb91413491fae3d65
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException{ FastScanner in = new FastScanner(); int n = in....
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
4d0748050d8cff7eb7326c31a21e1e52
train_003.jsonl
1423931400
There are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x, y) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (x0, y0). In one shot it can can de...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Set; public class ProblemB { BufferedReader rd; private ProblemB() throws IOException { rd = new BufferedReader(new InputStreamReader(System.in)); compute(); ...
Java
["4 0 0\n1 1\n2 2\n2 0\n-1 -1", "2 1 2\n1 1\n1 0"]
1 second
["2", "1"]
NoteExplanation to the first and second samples from the statement, respectively:
Java 7
standard input
[ "geometry", "math", "implementation", "data structures", "brute force" ]
8d2845c33645ac45d4d37f9493b0c380
The first line contains three integers n, x0 и y0 (1 ≤ n ≤ 1000,  - 104 ≤ x0, y0 ≤ 104) — the number of stormtroopers on the battle field and the coordinates of your gun. Next n lines contain two integers each xi, yi ( - 104 ≤ xi, yi ≤ 104) — the coordinates of the stormtroopers on the battlefield. It is guaranteed tha...
1,400
Print a single integer — the minimum number of shots Han Solo needs to destroy all the stormtroopers.
standard output
PASSED
3b304230d438d603055def258a2c2ed1
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
//package codeforces.R470; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(S...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
00b55d2fbcff8f0d0763881d20720755
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
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.StringTokenizer; import java.io.Writer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; ...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
d0fb5859cb74c998532803864beabbe4
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.util.*; public class C { public C () { int N = sc.nextInt(); int [] A = sc.nextInts(); int [] P = sc.nextInts(); TreeMap<Integer, Integer> M = new TreeMap<>(); for (int p : P) M.put(p, (M.containsKey(p) ? M.get(p) : 0) + 1); int [] res = new int [N]; for (int i : rep(N)) { SortedMap...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
02847a92a34d7e9d53cc6f4445a3f638
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.util.*; public class C { public C () { int N = sc.nextInt(); int [] A = sc.nextInts(); int [] P = sc.nextInts(); Counter<Integer> M = new Counter<>(); for (int p : P) M.inc(p); int [] res = new int [N]; for (int i : rep(N)) { int from = M.firstKey(), to = M.lastKey(); for (int j ...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
f2892e070be2e936f294f4e270ad1a3e
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; Out...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
c52d312c75d243bd7d4e8d17a0cccc40
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; Out...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
24d950665c1c44c74960daa963e2e620
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.Writer; import java.io.Buffer...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
3c7194750b0520b56b8c56192f4df372
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.Writer; import java.io.Buffer...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
ea991e2103fb5aa76cf72031b7a63984
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.Writer; import java.io.Buffer...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
dbce915de8cb8f4938752d281e049354
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.InputStream; /** * Built using CHelper p...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
ad3e9dcd7f71197cfc857a21bdc6fe18
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.awt.*; import java.awt.event.*; import java.io.*; import java.math.*; import java.text.*; import java.util.*; public class C { static BufferedReader br; static StringTokenizer st; static PrintWriter pw; public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStre...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
5a55f6e1c7430a489b551208e34a35fb
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.io.*; import java.util.*; public class Test { int readInt() { int ans = 0; boolean neg = false; try { boolean start = false; for (int c = 0; (c = System.in.read()) != -1; ) { if (c == '-') { start = true; ...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
2cc6f745d85fba8ce201a09cd3422c4b
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.io.*; import java.util.*; public class Test { int readInt() { int ans = 0; boolean neg = false; try { boolean start = false; for (int c = 0; (c = System.in.read()) != -1; ) { if (c == '-') { start = true; ...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
fce9890fba76b656bf34e205d5e6c72a
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.io.*; import java.util.*; /* 3 8 4 13 17 2 7 */ public class c { public static void main(String[] arg) throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int[] vs = new int[n]; for(int i = 0; i < n; i++) {...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
9d54d7ac896c92085d624270f8ab04de
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class C { public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); // Scanner scan = new Scanner(System.in); PrintWriter out = new P...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
5974a16e43e675986adc993906139f38
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class C { public static void main(String[] args) throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); // Scanner scan = new Scanner(System.in); PrintWriter out = new P...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
43a70b8bfa51b9b58cbf492133f82efd
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class ProblemC { BufferedReader rd; ProblemC() throws IOException { rd = new BufferedReader(new InputStreamReader(System.in)); compute(); } private void compute() throws IOException { ...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
cf74e961dfc451740adc577e04d7a035
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
512 megabytes
import java.util.*; import java.io.*; public class MainD { static int mod = (int) (1e9+7); static InputReader in; static PrintWriter out; public static void main(String[] args) { in = new InputReader(System.in); out = new PrintWriter(System.out); i...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
d8ac16effe6c4f18fa0cb72198f8968b
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
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 * * @author Pr...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
63c2fd5304d39b14df43fa3f9c6a2224
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
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.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution i...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
630b10d1a460fca939db07d1b43faf4b
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
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 * * @author Pr...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output
PASSED
d9eae2ae58a9a159ae40125cd273c705
train_003.jsonl
1520696100
Alice has a very important message M consisting of some non-negative integers that she wants to keep secret from Eve. Alice knows that the only theoretically secure cipher is one-time pad. Alice generates a random key K of the length equal to the message's length. Alice computes the bitwise xor of each element of the m...
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.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution i...
Java
["3\n8 4 13\n17 2 7", "5\n12 7 87 22 11\n18 39 9 12 16", "10\n331415699 278745619 998190004 423175621 42983144 166555524 843586353 802130100 337889448 685310951\n226011312 266003835 342809544 504667531 529814910 684873393 817026985 844010788 993949858 1031395667"]
3.5 seconds
["10 3 28", "0 14 69 6 44", "128965467 243912600 4281110 112029883 223689619 76924724 429589 119397893 613490433 362863284"]
NoteIn the first case, the solution is (10, 3, 28), since , and . Other possible permutations of key yield messages (25, 6, 10), (25, 3, 15), (10, 21, 10), (15, 21, 15) and (15, 6, 28), which are all lexicographically larger than the solution.
Java 8
standard input
[ "data structures", "greedy", "trees", "strings" ]
dc778193a126009f545d1d6f307bba83
The first line contains a single integer N (1 ≤ N ≤ 300000), the length of the message. The second line contains N integers A1, A2, ..., AN (0 ≤ Ai &lt; 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≤ Pi &lt; 230) representing the permuted encryption key.
1,800
Output a single line with N integers, the lexicographically smallest possible message O. Note that all its elements should be non-negative.
standard output