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
60d0a89eafadd9a39b6e52be159a3f59
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 < 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≀ Pi < 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
0b04f9eb6615269fcde0224e1bf8207b
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 < 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≀ Pi < 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
82aeb65d333bd4e2c8767d6169201d0d
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 < 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≀ Pi < 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
e4bf6ffc03452dbd7da270aa14a9f769
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 Main { static BufferedReader reader = null; static StringTokenizer tokenizer = null; static PrintWriter writer = null; static String nextToken() throws IOException { while (tokenizer == null || !tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(re...
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 < 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≀ Pi < 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
a0a5592427dd004f8901afa959f00d80
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.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
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 < 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≀ Pi < 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
a90221f52215d41f95ffe3e89c2f784b
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 com.company; import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { MyScanner sc = new MyScanner(System.in); PrintWriter pw = new PrintWriter(System.out); long start = System.currentTimeMillis(); Task t = new Ta...
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 < 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≀ Pi < 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
ce0edcf8133e507ab4f1c947ed318055
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.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; /* public class _948C { } */ public class _948C { class trie { class node { int subsz; node left; ...
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 < 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≀ Pi < 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
375ea66e260b321c8e26b87c4b770f9a
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 round470; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class C { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); int...
Java
["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 < 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≀ Pi < 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
d9a936b342b332c92ad366f2daf2ef95
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.util.Arrays; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcept...
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 < 230) representing the encrypted message. The third line contains N integers P1, P2, ..., PN (0 ≀ Pi < 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
d86449f10da499b1db2dfafaf3e61633
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.math.*; import java.util.*; public class C { static final int LOG = 30; int[][] to; int[] cnt; int sz; int newNode() { to[0][sz] = to[1][sz] = -1; return sz++; } void submit() { int n = nextInt(); int[] a = new int[n]; int[] p = 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
afdc72539da6c7fde7e09e767582266c
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.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.List; import java.util.Queue; import static java.lang.Math.max; import static java.lang.Math.min; public class C implements Runnable{ // SOLUTION AT THE TOP OF CODE!!! // HACK ...
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
ef152fdece9aec4fc154651dda0d0135
train_003.jsonl
1267963200
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times b...
64 megabytes
//package cf_3b; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; public class Main { public static void main(String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System....
Java
["3 2\n1 2\n2 7\n1 3"]
2 seconds
["7\n2"]
null
Java 8
standard input
[ "sortings", "greedy" ]
a1f98b06650a5755e784cd6ec6f3b211
The first line contains a pair of integer numbers n and v (1 ≀ n ≀ 105; 1 ≀ v ≀ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi...
1,900
In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them.
standard output
PASSED
15b6aa5e306ca59dd418a33feaee9162
train_003.jsonl
1267963200
A group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (and each of them occupies the space of 1 cubic metre), and all catamarans are of the same size, but two times b...
64 megabytes
// Problem : B. Lorry // Contest : Codeforces - Codeforces Beta Round #3 // URL : https://codeforces.com/problemset/problem/3/B // Memory Limit : 64 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) import java.io.*; import java.util.*; import java.util.stream.*; public class ...
Java
["3 2\n1 2\n2 7\n1 3"]
2 seconds
["7\n2"]
null
Java 8
standard input
[ "sortings", "greedy" ]
a1f98b06650a5755e784cd6ec6f3b211
The first line contains a pair of integer numbers n and v (1 ≀ n ≀ 105; 1 ≀ v ≀ 109), where n is the number of waterborne vehicles in the boat depot, and v is the truck body volume of the lorry in cubic metres. The following n lines contain the information about the waterborne vehicles, that is a pair of numbers ti, pi...
1,900
In the first line print the maximum possible carrying capacity of the set. In the second line print a string consisting of the numbers of the vehicles that make the optimal set. If the answer is not unique, print any of them.
standard output
PASSED
051d3e42c2910d75d8a0ad76fa27f016
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bu...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
a0d9cd6b31e2fe57fedc8f85383a2ac1
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import javax.print.DocFlavor; import javax.swing.plaf.basic.BasicInternalFrameTitlePane; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.nio.Buffer; import java.sql.BatchUpdateException; import java.util.*; import java.util.stream.Stream; import java.util.Vector; import java.i...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
a3d6fc4c6c9c278b8790c732fa8c4f56
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.BitS...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
4b8fb02359aa773552fff1cb383f5ea0
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.awt.*; import java.io.*; import java.util.*; public class Abc { public static void main(String[] args) throws Exception { FastReader sc = new FastReader(); int n = sc.nextInt(); int a[] = new int[n]; for (int i = 0; i < n; i++) a[i] = sc.nextInt(); int l = 0, r ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
3581000039fe08ee767a6dd849beb42b
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.Scanner; public class asdasd { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int maxn=2000000; int n=scan.nextInt(); char s[]=new char[maxn]; int h[]=new int[maxn]; int a[]=new int[maxn]; for(int i=1;i<=n;i++) { a[i]=scan.nextInt(); } int l=1,r...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
8bbc0cf6103cf7836ae9f25fc9387abf
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); int[] a = na(n); i...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
c58bd1dbd9859cb337879b7b390d01f0
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.*; import static java.lang.Math.*; import java.util.*; public class IncreasingSubsequencehardversion { static String res = ""; static int arr[]; static void solve(int le, int r, int last, StringBuilder s) { if ((le<=r&&arr[le] <= last && arr[r] <= last) || le > r) { if...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
de681fa2c16182b93bbc2e43dd4eb4e1
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.math.*; import java.util.*; //good question public class Main { public static void main(String[] args) ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
426c4276e77b8c3eb9eb2160c441677a
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
//Author: Patel Rag import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
917e4c22cf4374683af7a937b4306692
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.*; import java.io.*; public class IncreasingSubsequenceHard { // https://codeforces.com/contest/1157/problem/C2 public static void main(String[] args) throws IOException, FileNotFoundException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); //BufferedReader in = ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
cce06d9fc9ad1e83b85bf6178e0d5394
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
// Change Of Plans BABY.... Change Of Plans // import java.io.*; import java.util.*; import static java.lang.Math.*; public class increasingSubSequence { static void MainSolution() { n = ni(); int ar[] = new int[n]; for (int i = 0; i < n; i++) ar[i] = ni(); int l = 0, r = n - 1; ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
1ff4a0448b1350a35b61e2c88c81bf62
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
/** * @author cplayer on 2018/6/23. * @version 1.0 */ import java.util.*; import java.io.*; import java.lang.*; public class Main { public static void main(String[] args) { try { InputReader in; PrintWriter out; boolean useOutput = false; if (System.getP...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
2b4030e4e1725c365d9195aa33fba536
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class A { public static void main(String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(); Deque<Integer> q = new LinkedList<Integer>(); for(int i=0;i<n;i++){ int x = in.nextInt(); q.add(x); } int l1=0,r1=0; char ch[]=new c...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
1c6a6e64e9e3a5e8672d322afe19cba2
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.Scanner; public class CFP { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int start = 0; int end = scan.nextInt(); int[] sequence = new int[end--]; for (int i=0; i<sequence.length; i++) { sequence[i] = scan.next...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
a8b3f06ba0f4435605cb5f143933241d
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; import java.math.BigInteger; public class C2 { public static void main(String[] args) throws Exception { FastScanner scanner = new FastScanner(); int n = scanner.nextInt(); int[] seq = scanner.nextIntArray(); in...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
fc99faf81aa6e32c896ae0e79a8666a7
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class test { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; PrintWriter out = new PrintWriter(outputStream); InputReader in = new InputReader(inpu...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
4b53170e371c1d185c6d841dbe053183
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Ribhav */ public class Mai...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
51ce32fa4279cd380db75c9c07cc3800
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
// Utilities import java.io.*; import java.util.*; public class Main { static int N; static Deque<Integer> dq = new ArrayDeque<Integer>(); static int max = -1; static Queue<Character> resList = new LinkedList<Character>(); static int length = 0; public static void main(String[] args) throws IOException { N ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
adde15f4ffa3d1d374e8a558db94e104
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.Scanner; public class CodeForces555C2 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = scanner.nextInt(); } StringB...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
f15e90ffbb02ce79605a592134e81ca8
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.*; public class Codechef { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int p = n; int[] seq = new int[n]; int i = 0; StringBuilder str=new StringBuilder(""); int prev = 0; int m=0; int a=0; int b = 0; int v = 0; int q = ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
8226046b0849cfb5a38a5a7c4792c3a4
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { Scanner s=new Scanner(System.in); int n=s.nextInt(); int[] a=new int[n]; int temp=0; Arr...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \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 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ β€” the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
12e0484ac6051c56e6d1d8d930ac969b
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.regex.PatternSyntaxException; public class PartialTeacher { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputSt...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
e2c9a761006908ab898e44294671b8b7
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
//package manthan; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A { static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWri...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
d7de555121418904c5a9d470edbd41f1
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.io.*; import java.util.*; /** * Manthan 2011, A * @author Roman Kosenko <madkite@gmail.com> */ public class PartialTeacher { public static int[] solve(char[] signature) { int result[] = new int[signature.length + 1], v = 1; for(int i = signature.length; i > 0; i--) { switch(signature[i - 1]) { ...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
8622c9533b1dc09e59e3b6c06fbc83df
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C_61A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); int []a = new int [n]; Arrays.fill(a, 1); for(int j = 0; j<=n; j++) ...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
1f60b6a222e6ab842b06897c360ddf17
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.util.Arrays; /** * Created by IntelliJ IDEA. * User: piyushd * Date: 3/13/11 * Time: 9:43 PM * To change this template use File | Settings | File Templates. */ public class Task1 { void run(){ int n = nextInt(); String comp = next(); int[] a = new int[n]; Arrays.fill(a, 1); for (int i...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
fed975ba7f4a2267edd8cdd1342c8cc1
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.util.Arrays; /** * Created by IntelliJ IDEA. * User: piyushd * Date: 3/13/11 * Time: 9:43 PM * To change this template use File | Settings | File Templates. */ public class Task1 { void run(){ int n = nextInt(); String comp = next(); int[] a = new int[n]; Arrays.fill(a, 1); for(int i ...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
b3dfb23e540a09f59cc76350652fa818
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class CF1 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
cab0851d0881422d90f52d4ade6a260a
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; p...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
802fb8391e19cd3dfa807db3087f8444
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class p67a { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); char[] x = in.next().toCharArray(); int[] res = new int[n]; Arrays.fill(res, 1); while(true) { ...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
f3f04bf9fc5c9db0ff53321c55f03160
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class Solution { static int[] a; static String s; public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = Integer.parseInt(in.nextLine()); ...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
5f13c4e07ff9bad88053897b34f93408
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.io.BufferedInputStream; import java.util.Random; import java.util.Scanner; public class PartialTeacher { public static void main(String[] args) { Scanner scn = new Scanner(new BufferedInputStream(System.in)); int n = scn.nextInt(); String s = scn.next(); int[] res = so...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
da7824c4ba6bf630b28b35a753967832
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.fill; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { public static void main(String[] args) throws IOException { new Thread(null, new Runnable() { public voi...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
c36d22639814bcb0c6d89637ebc7e326
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Manthan2011_A implements Runnable { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); void init() throws IOException { i...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
84435dcea44c96a50c171482834b0776
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.Arrays; import java.util.Scanner; public class Main { private static StreamTokenizer in; private static PrintWriter out; private static BufferedReader inB; ...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
23c662b9c4006f4d9034098da566cede
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ //package a; /** * * @author ΠšΠ°Ρ‚Π΅Ρ€ΠΈΠ½Π° */ import java.io.*; import java.util.*; public class Main { public static void main(String args[]) throws IOException { boolean online = System.getProperty("ONLINE_JUDGE")...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
1c3b515bad842bdbfaf588f5e84342c1
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.io.*; import java.util.*; public class Cf_Man_A { public static void main( String[ ] args ) throws Throwable { BufferedReader bIn = new BufferedReader ( new InputStreamReader( System.in ) ); PrintStream out = new PrintStream( System.out ); int n = Integer.parseInt( bIn.read...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
cfcae6c38eef841577e29484fb647005
train_003.jsonl
1300033800
A teacher decides to give toffees to his students. He asks n students to stand in a queue. Since the teacher is very partial, he follows the following rule to distribute toffees.He looks at the first two students and gives more toffees to the student having higher marks than the other one. If they have the same marks t...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.jar.JarEntry; /** * @author Vitaly Zubchevskiy * Created at 19:31 13.03.11 */ public class A { public static void main(String[] args) throws IOException { BufferedReader is = new Buf...
Java
["5\nLRLR", "5\n=RRR"]
1 second
["2 1 2 1 2", "1 1 2 3 4"]
null
Java 6
standard input
[ "dp", "implementation", "greedy", "graphs" ]
8c2a6a29dc238b55d0bc99d7e203f1bf
The first line of input contains the number of students n (2 ≀ n ≀ 1000). The second line gives (n - 1) characters consisting of "L", "R" and "=". For each pair of adjacent students "L" means that the left student has higher marks, "R" means that the right student has higher marks and "=" means that both have equal mar...
1,800
Output consists of n integers separated by a space representing the number of toffees each student receives in the queue starting from the first one to the last one.
standard output
PASSED
b5d600ea8d4b419f38bfbfb9b4f8bf52
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
public class Easy { public static void main(String[]args) { java.util.Scanner input = new java.util.Scanner(System.in); int size = input.nextInt(); String[] s = new String[size]; for(int i=0 ; i<size ; i++) { s[i] = input.next(); } if(size==0 || size==1) { System.out.println("YES"); Syst...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
0d6519ab6b1b729ae9b95364bbb122ac
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.Set; import java.util.Stack; import javafx.util.Pair; public class Ahmed { public static void main(String[] args) { Scanner input=new Scanner (System.in); int n=input...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
746fea820c1558db9f4f139c2bd52dcd
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
//package codeforces.codeforces.A; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner sc = n...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
5f76bd05516f5160dd998959abdff30e
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class ApplemanAndEasyTask { public static void main(String[] args) throws Exception { BufferedReader b = new BufferedReader(new InputStreamReader(System.in)); int loop = Integer.parseInt(b.readLine()); char[][] c1 = new...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
ea786552b15507ec05b7151497abcde5
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class WizardDuel { static int[] dx = { 1, 0, 0, -1 }; static int[] dy = { 0, 1, -1, 0 }; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[][] a = new char[n][n]; for (int i = 0; i < n; i++) { a[i] = sc.next().toCh...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
9418586f9db72139f520c9249f3ae396
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); char[][] a = new char[n][n]; for (int i = 0; i < n; i++) { String s = in.next(); for (int j = 0; j < n; j++) {/...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
5bd272a1ddfd964fc3e5604967fe275d
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.*; public class Alphabetanalyser { public static void main(String args[]){ Scanner in=new Scanner(System.in); int n=in.nextInt(); char array[][]=new char[n][n]; for(int i=0;i<n;i++){ String temp=in.next(); array[i]=temp.toCharArray(); } boolean flag=true; for(int i=0;i<n;i++){ for(int j=0;j<n;j++)...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
b3b182a43a165206d46414355ab8f10f
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class JavaApplication79 { public static void main(String[] args) { Scanner s = new Scanner (System.in); boolean b=true; String x; int n=s.nextInt(),count=0; String ar[][]=new String [n][n]; for (int i = 0; i < n; i++) {x=s.nex...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
05d2276cc77eb958af234aa608919ba3
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { static class ProblemSolver{ public void solveTheProblem(InputReader in,PrintWrit...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
73a62fd8885dea2e4f6714347463f162
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.*; public class tata { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.nextLine()); String[] board = new String[n]; for(int i=0;i<n;++i)board[i]=sc.nextLine(); for(int i=0;i<n;++i){ for...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
0182d78222170976160fc2161eaf9114
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Locale; import java.util.StringTokenizer; public class A{ static StringTokenizer st; ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
2bf1e7632df0fa0f60668a6a437c3717
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main{ public static void main(String []args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(in.readLine()); ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
29700db7dda2dc8407c9e98db09f91fa
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main{ public static void main(String []args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(in.readLine()); ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
85eeff00e1d273ade017f9d2c8208252
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc=new Scan...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
3bdecadc032e3b6859be4618fc2f18f4
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); char[][] arr = new char[t][t]; for (int i = 0; i < arr.length; i++) { String s = sc.next(); arr[i] = s.toCharArray(); ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
f0e4569695bf82575ae40e4c4a18887d
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc= new Scanner (System.in); int n=sc.nextInt(); sc.nextLine(); char[] c; char[][] mat=new char[n][n]; if(n==1){ sc.nextLine(); System.out.println("YES"); return; } for(int i=0;i<n;i++){ c=s...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
18aa0f11931fe9ca0277e383b0e34285
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.*; public class CF462A { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); String s = ""; for (int i = 0; i < n; i++) s += scan.next(); String reverse = new StringBuilder(s).reverse().toString(); Sy...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
4b6ce01222750b9245bc08fdc6a07fb7
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class Appleman{ public static void main(String args[]){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); char[][] matrix = new char[n+2][n+2]; matrix[0] = new char[n+2]; matrix[n+1] = new char[n+1]; ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
1caa06340d960590bebea4182ca018cf
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.*; public class Problems { private static Scanner input; public static void main(String[] args) { int n,i,j,counter=0,flag=1; input = new Scanner(System.in); n=input.nextInt(); char[][] word=new char[n][n]; String[] board=new String[n]; for(...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
30093203ce19fe679aa8f17912883cfe
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Integer.*;; public class A { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int n = parseInt(in...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
1f42113e0904783d9e15a0c2199966a8
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class ApplemanandEasyTask { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); Character[][] arr = new Character[105][105]; for(int i = 0; i < n; i++) { String s = sc.next(); f...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
ede44cb9c23a89e5a8ef036fdffb8ce9
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.*; public class Main { public static void main(String[]args) { Scanner input=new Scanner (System.in); while(input.hasNext()) { int n=input.nextInt(); String z[]=new String[n]; for(int x=0;x<n;z[x]=input.next(),x++); boolean...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 8
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
d957337f41e791b78d1372a8cdad9c35
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.math.BigInteger; import java.time.chrono.MinguoChronology; import java.util.*; import javax.xml.bind.SchemaOutputResolver; public class Main { private static int maxn=100005; private static int one=1; public static int solve(Vector<Integer> a,int bit) { if(a.size()==0||bit<0) return 0; Vector<Integ...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
028c2310e7081a74200700ca366f6d03
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.util.*; import java.io.*; import java.text.*; import java.math.*; import static java.lang.Integer.*; import static java.lang.Double.*; import java.lang.Math.*; public class dr_evil_underscores { public static void main(String[] args) throws Exception { new dr_evil_underscores().run(); } public stati...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
505322c1a9cc645297e2cd511e1163f8
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; import java.util.TreeSet; ...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
f1bc496890db0137718bbd2115536ef0
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; import static java.lang.Math.min; public class Main { static final int mod = (int)1e9+7; public static void main(String[] args)...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
8a5f48b0bb71550546b58add30ad5741
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; /** * @author Mubtasim Shahriar */ public class DrEvil { public static void ...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
786f1347d4703e7867307a7de4b133c7
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); new Main().run(in, out); out.close(); } int N; void run(Fast...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
aa7f9569f9bee610a394056d6b2ef482
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.util.*; public class d { public static void main(String[] args) { new d(); } FS in = new FS(); PrintWriter out = new PrintWriter(System.out); int n; int[] a; d() { n = in.nextInt(); a = new int[n]; for (int i = 0; i < n; i++) a[i] = in.nextInt(); /* suffMax = new int[...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
b188a85df76807d012d12c762043ab1b
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.util.*; public class Codeforces { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); ...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
c59a897940ecc681ddb62d8f79580f1a
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class ProblemD { public static InputStream inputStream = System.in; public static OutputStream outputStream = System.out; public static void main(String[] args) { MyScanner scanner = new...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
e46bad849253458e9068a83d99bf1bb9
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.util.*; public class Main { static PrintWriter out = new PrintWriter(System.out); static Scanner sc = new Scanner(System.in); static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { ...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
3bd67b51d12a563ddbd12730a6dc0652
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { InputStream is; PrintWriter out; String INPUT = ""; //class Declaration static class pair implements Comparable < pair > { long x; long y; pair(long i, long j) { x = i; y = j; } public int compareTo(pair p) { if...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
2b66e52507f4c6199f51cc68fb10db85
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ public Solution(){ Scanner sc = new Scanner(System.in); int tests = 1; for(int t=1; t<=tests; t++){ int n = sc.nextInt(); int[] arr = new int[n]; for(int i=0; i<n; i++){ arr[i] = sc.nextInt(); } Node root =...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
aa2adaf5d806ccb41e5fa50bba316478
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashSet; import java.util.InputMismatchException; import java.util.Set; public class Main { InputStream is; PrintWriter out; String INPUT = ""; privat...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
9201237a27a6274158225bd3d7c65826
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } long mod=1000000007; long gcd(long a,long b) { return a==0?b:b>=a?gcd(b%...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
e0a7dbd2fbfeebcb1a775706ec453654
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.util.*; public class evilXOR { public static void main(String s[]) throws Exception { Reader r = new Reader(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = r.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
36a0a7837aecfca0d1107d206a55e29f
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.nio.CharBuffer; import java.util.NoSuchElementException; public class P1285D { public static void main(String[] args) { SimpleScanner scanner = new SimpleScanner(System.in); PrintWriter writer = new PrintWriter(System.out); final int MAX_BIT = 30; int...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
54443f5d350201bc2979f9f1da0dc1f4
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static int solve(SortedSet<Integer> set, int idx, int or) { SortedSet<Integer> set1 = set.headSet(or | (1 << idx)); SortedSet<Integer> set2 = set.tailSet(or | (1 << idx)); if (idx == 0) { return set1.isEmpty() || set2.isEmpty() ? 0 : 1; } i...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
987eaed4ea9eecba7a6bf843d29e85bc
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class DEU_1285D { public static void main(String[]args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); ArrayList<Integer> a = new ArrayList<Integer>(); int high = -1, count = 0; for (int i = 0; i < n;...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
bd2a7b5d8a2d56bdb46c315e4039ba92
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.lang.*; import java.util.*; import java.io.*; public class Main { void solve() { int n=ni(); trie=new int[40*n+1][2]; for(int i=1;i<=n;i++) add(ni()); int ans=dfs(0,29); pw.println(ans); } int trie[][]; int C=0; void add(int x){ int curr=0;...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
2eb0773c9eeb5f4be9166f5d72789f44
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Collection; import java.util.InputMismatchException; import java.io.IOException; import java.util.NoSuchElementException; import java.io.InputStream; /** * Built using CHelper plug-in * A...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
31da00c0c4f452a3eac1430f79371972
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; import static java.lang.Math.abs; import static j...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
80498d360925c48c76b07c342de64a89
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class D1285_DrEvilUnderScore { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); List<Integer> list = new ArrayList<>(); for(int i = 0; i < n; i++) { ...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
455cdd625632e87997d90b97c45d14f6
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.List; //javac Main.java & java Main showTrace:1 runOnEditor:0 inputFromLocal:1 outputToLocal:0 //javac Main.java ; java Main showTrace:1 runOnEditor:1 inputFromLocal:0 outputToLocal:0 public class Main extends Core { protected static final int MOD = (in...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
b5351349698db1f4aaf518226db2320c
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.List; //javac Main.java & java Main showTrace:1 runOnEditor:0 inputFromLocal:1 outputToLocal:0 //javac Main.java ; java Main showTrace:1 runOnEditor:1 inputFromLocal:0 outputToLocal:0 public class Main extends Core { protected static final int MOD = (in...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
80d55fa3942517a0199cc9e9acdf1159
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.List; //javac Main.java & java Main showTrace:1 runOnEditor:0 inputFromLocal:1 outputToLocal:0 //javac Main.java ; java Main showTrace:1 runOnEditor:1 inputFromLocal:0 outputToLocal:0 public class Main extends Core { protected static final int MOD = (in...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
df30f683013cf7bdf99eb5a65d8dde91
train_003.jsonl
1578665100
Today, as a friendship gift, Bakry gave Badawy $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ and challenged him to choose an integer $$$X$$$ such that the value $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$ is minimum possible, where $$$\oplus$$$ denotes the bitwise XOR operation.As always, Badawy is too lazy, so...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.List; //javac Main.java & java Main showTrace:1 runOnEditor:0 inputFromLocal:1 outputToLocal:0 //javac Main.java ; java Main showTrace:1 runOnEditor:1 inputFromLocal:0 outputToLocal:0 public class Main extends Core { protected static final int MOD = (in...
Java
["3\n1 2 3", "2\n1 5"]
1 second
["2", "4"]
NoteIn the first sample, we can choose $$$X = 3$$$.In the second sample, we can choose $$$X = 5$$$.
Java 8
standard input
[ "dp", "greedy", "bitmasks", "divide and conquer", "brute force", "dfs and similar", "trees", "strings" ]
d17d2fcfb088bf51e9c1f3fce4133a94
The first line contains integer $$$n$$$ ($$$1\le n \le 10^5$$$). The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 2^{30}-1$$$).
1,900
Print one integer β€” the minimum possible value of $$$\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$$$.
standard output
PASSED
9a113fa9330a577da22f339cd691a1e4
train_003.jsonl
1605796500
You are given a string $$$s$$$, consisting of brackets of two types: '(', ')', '[' and ']'.A string is called a regular bracket sequence (RBS) if it's of one of the following types: empty string; '(' + RBS + ')'; '[' + RBS + ']'; RBS + RBS. where plus is a concatenation of two strings.In one move you can choose a ...
256 megabytes
import java.util.*; import java.io.*; public class sol { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } public FastReader(String giveMeFile) throws IOException...
Java
["5\n()\n[]()\n([)]\n)]([\n)[(]"]
1 second
["1\n2\n2\n0\n1"]
NoteIn the first example you can just erase the whole string.In the second example you can first erase the brackets on positions $$$1$$$ and $$$2$$$: "[]()", then "()" is left. After that you can erase it whole. You could erase the whole string from the beginning but you would get one move instead of two.In the third e...
Java 8
standard input
[ "greedy" ]
db9cec57d8ed5e914818ce9b439eb0f9
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$)Β β€” the number of testcases. Each of the next $$$t$$$ lines contains a non-empty string, consisting only of characters '(', ')', '[' and ']'. The total length of the strings over all testcases doesn't exceed $$$2 \cdot 10^5$$$.
800
For each testcase print a single integerΒ β€” the maximum number of moves you can perform on a given string $$$s$$$.
standard output