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
e116ef8eb2f12c9abe945a05369dfb33
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codechef { static long fans[] = new long[200001]; static long inv[] = new long[200001]; static long mod = 1000000007; static void init() { fans[0] = 1; inv[0] = 1; fans[1] = 1; inv[1] = 1; for (int i = 2; i < 200001; i+...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
7512cc5be7959faad991785828d75bd6
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.util.*; import static java.lang.Math.*; import java.io.*; public class S { public static int surv = 0; public static void main(String args[])throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int test = Integer.parseIn...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
bc5860681110c0927b20265d6e4517c0
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static ArrayList<ArrayList<Integer>> adjacencyList; private static boolean[] visited; private static void dfs(int u) { visited[u] = true; for(int v: adjacencyList.get(u)) { if(!visited[v]) { ...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
58f6eb3e995b45e45f36ab18217a5ce2
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
//Game Master import java.io.*; import java.util.*; public class C1608{ public static void main(String[] args)throws IOException{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int t = Integer.parseInt(f....
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
46ee40899bce5e85acde5f1a7f4f87c4
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class C{ static class Pair implements Comparable<Pair>{ int a, b, i; public Pair(int x, int y, int z) { a=x; b=y; i=z; } public int compareTo(Pair o) { if (i == o.i) return 0; return a-o.a; } ...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
c36567238e5b7eead07d1ec88c40049a
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /** * @author Naitik * */ public class Main { static FastReader sc=new FastReader(); static long dp[]; //static int v[][]; // static int mod=998244353;; static int mod=1000000007; static int max; static int bit[]; //sta...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
32d4ca27a243bb0f4cebf70b67be2990
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.*; public class Main { static InputReader2 sc=new InputReader2(System.in); /* static int MAXN=200005,n,m,a[]=new int[MAXN],dp[]=new int[MAXN],edge[][]=new int[MAXN][2]; static long k; static boolean vis[]=new boolean[MAXN],ok=fals...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
8274982a377e4ced4a5358e0883ef4ad
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.util.*; import java.io.*; public class Solution { static void dfs(int n , ArrayList<Integer> g[] , boolean vis[]) { vis[n] = true; for(Integer v : g[n]) { if(!vis[v]) { dfs(v,g,vis); } } } pub...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
fbd14f00e3f658cb2ac613eb65fbf1e2
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class code{ public static int GCD(int a, int b) { if (b == 0) return a; return GCD(b, a % b); } public static void shuffle(int a[], int n) { for (int i = 0; i < n; i++) { ...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
52a624f7369e660d0f30ec617da8e378
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.awt.Container; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import j...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
bc76b2af67923c1909e46f86fc9f9c60
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.awt.Container; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class Main { public static class p...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
ba9719f55b3c76ecac62027847491791
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.util.InputMismatchException; import java.io.InputStreamReader; import java.io.Writer; import java.io.BufferedRead...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
aa8a380ffee4fea238f1c060551fcf29
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class Player implements Comparable<Player> { int strength; int idx; Player(int strength, int idx) { this.strength = strength; this.idx = idx; } @Override public int compareTo(Player other) { return this.streng...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
3ff9efefb5e01e36c45dbcaea16c630c
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.util.*; import java.io.*; public class C { public static void inc(int[] vis, int[] cnt, int idx, boolean first) { cnt[vis[idx]]--; vis[idx] |= (first ? 1 : 2); cnt[vis[idx]]++; } public static void main(String[] args) throws IOException { Scanner sc =...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
257474130813463b468ed61618a1ca0c
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter pr = new PrintWriter(System.out); static String readLine() throws IOException { return br.readLine(); } static Strin...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
569d71ddb7bd2fa349d0b1dbcc0427a1
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class tr2 { static PrintWriter out; static StringBuilder sb; static long mod = (long) 1e9 + 7; static long inf = (long) 1e16; static int n, m, k; static ArrayList<Integer>[] ad; static int[][] remove, add; static long[][] mem...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
ff966bee9a012c2bef02e6388f4055f0
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.Arrays; import java.util.Queue; import java.util.StringTokenizer; public class C1608 { public static v...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
8bda2da67caa77a32cbaedfeca6f45b7
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*; import java.util.*; public class C1608{ public static void main(String[] args)throws IOException{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int t = Integer.parseInt(f.readLine()); ...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
8e06fb8085e69de7d45a86351bf1fd7c
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*; import java.util.*; public class C1608{ public static void main(String[] args)throws IOException{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int t = Integer.parseInt(f.readLine()); ...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
ed48e53d67b2c9d1448731dbdad6adfa
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
/* * Everything is Hard * Before Easy * Jai Mata Dii */ 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.h...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
59a9c59eac0c23ac82b267d6bf4fdf17
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static class DSU { private int[] parent; private int[] size; private int totalGroup; private int maxSize = 1; public DSU(int n) { parent = new int[n]; totalGroup = n; ...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
46a6f98446fb113e8286eed97876e836
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.StringTokenizer; public class C { static ArrayList<Integer>[] adj; static boolean vis[]; public static void main(String[] args) throws IOException { Scanner sc...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
29fd198a4e1fcc8f3df5e43770cce878
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Bit...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
b07073dbc073cc53944928e9a1e28fed
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.lang.reflect.Array; import java.util.*; import java.util.stream.Stream; public class Program { static BufferedReader reader = new Bu...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
5934b66077b12389f067a0b1cfd28e4c
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import static java.lang.Math.*; // Sachin_2961 submission // public class CodeforcesA { public void solve() { int n = fs.nInt(); PairI[]players = new PairI[n+1]; players[0] = new PairI(0,0,0); for(int i=1;i<=n;...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
f9af26377471d901ecc243ee95e61441
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import org.omg.PortableInterceptor.INACTIVE; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class gamemaster { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStream...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
ab888150f7fa7d8ae8f154d37988a6ea
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static Scanner sc = new Scanner(System.in); // static Reader sc = new Reader(); static StringBuilder out = new StringBuilder(); static String testCase = "Case #"; static long mod = 998244353; public static void main(String[] args)...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
c6407506e1e93412160b9484aad274ae
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Stream; public class C_758 { public static final long[] POWER2 = generatePOWER2()...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
6651cf32958b2724cd522344b85cf3c0
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
//package Div2.C; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class GameMaster { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t=I...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
1b45350a122a0df2bd386f5da37d177b
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.util.*; import java.io.*; ////*************************************************************************** /* public class E_Gardener_and_Tree implements Runnable{ public static void main(String[] args) throws Exception { new Thread(null, new E_Gardener_and_Tree(), "E_Gardener_and_Tr...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
bb709ab8df79213904b395d62ff176db
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.*;import java.util.*;import java.math.*;import static java.lang.Math.*;import static java. util.Map.*;import static java.util.Arrays.*;import static java.util.Collections.*; import static java.lang.System.*; public class Main { public void tq()throws Exception { st=new Stri...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
c68f5a324f40cc7e7ae49bfac43f6433
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; public class C { static BufferedReader br; static StringTokenizer st; static PrintWrite...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
e36d187d18fefe1e60405f923576b8e1
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStream; /** * Built using CHelper...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 8
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
9a1a64c6733256a636a898aecc29b682
train_109.jsonl
1639217100
$$$n$$$ players are playing a game. There are two different maps in the game. For each player, we know his strength on each map. When two players fight on a specific map, the player with higher strength on that map always wins. No two players have the same strength on the same map. You are the game master and want to o...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class Round758C { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String IMPO...
Java
["3\n4\n1 2 3 4\n1 2 3 4\n4\n11 12 20 21\n44 22 11 30\n1\n1000000000\n1000000000"]
1 second
["0001\n1111\n1"]
NoteIn the first test case, the $$$4$$$-th player will beat any other player on any game, so he will definitely win the tournament.In the second test case, everyone can be a winner. In the third test case, there is only one player. Clearly, he will win the tournament.
Java 17
standard input
[ "data structures", "dfs and similar", "dp", "graphs", "greedy", "two pointers" ]
f9cf1a6971a7003078b63195198e5a51
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of players. The second line of each test case contains $$$n$$$ integers $...
1,700
For each test case print a string of length $$$n$$$. $$$i$$$-th character should be "1" if the $$$i$$$-th player can win the tournament, or "0" otherwise.
standard output
PASSED
3e583b37101c7c0cfb54d530a0709fc1
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class Round758D { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String IMPO...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 17
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
ffedebc47aad07953e63be455cf2be51
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
/* I am dead inside Do you like NCT, sKz, BTS? 5 4 3 2 1 Moonwalk Imma knock it down like domino Is this what you want? Is this what you want? Let's ttalkbocky about that :() */ import static java.lang.Math.*; import java.util.*; import java.io.*; public class x1608D { static final long MOD = 998244...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 8
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
69b8300b96baaf40e1b928de6299b408
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) throws FileNotFoundException { InputReader in = new InputReader(System.in); // Scanner in = new Scanner(System.in); // Scanner in = new Scanner(new BufferedReader(new...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 8
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
9a1b4cf4ef68923f7b8df580773b9ae0
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.util.*; import java.io.*; public class D { static int mod = 998244353; static long[] fac, facInv; public static long modPow(long a, long e) { return e == 0 ? 1 : ((e % 2 == 1) ? (modPow(a, e - 1) * a % mod) : modPow(a * a % mod, e / 2)); } public static void init(in...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 8
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
8c4aac45ae49a6f0c8bb63dcf2afb621
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.io.*; import java.util.*; public class Main { static final int MOD = 998244353; public static void main(String[] args) { FastScanner fs=new FastScanner(); PrintWriter out = new PrintWriter(System.out); /****** CODE STARTS HERE *****/ //-------------------------------------------...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 11
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
15163ab01b47b92c8f9a7bb04e3b00ce
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.io.*; import java.util.*; public class Main { /** * @param args */ public static void main(String[] args) { FastScanner fs=new FastScanner(); PrintWriter out = new PrintWriter(System.out); /****** CODE STARTS HERE *****/ //-----------------------------------------------------...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 11
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
fb5232620e85c955ac74d906fefa76fd
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.io.*; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.math.*; /** __ __ ( _) ( _) / / \\ / /\_\_ / / \\ / / | \ \ / / \\ / / |\ \ \ / / , \ , / / /| \ \ / / |\_ /| ...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 11
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
5d3a0eaff8704aa422c925ab66670ffc
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf1608d_2 { public static void main(String[] args) throws IOException { int n = ri(), cntw = 0, cntb = 0, invalid = 1, cntqq = 0, allbw = 1, allwb = 1; int fact[] = new i...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 11
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
953cf5b449fd5b3977790422598d2821
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.io.*; import java.util.*; public class D implements constant { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pw = new PrintWriter(System.out, true); static long [] fact; static long [] invFact; // Fermats Little Theorem: ...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 11
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
e410c3affac2b2fcd80a5020dfe0c9b8
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf1608d_2 { public static void main(String[] args) throws IOException { int n = ri(), cntw = 0, cntb = 0, invalid = 1, cntqq = 0, allbw = 1, allwb = 1; int fact[] = ne...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 11
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
8335c932582b92ae13410ee30ba8be41
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.io.*; import java.util.*; public class Solution extends PrintWriter { void solve() { pre(); int n = sc.nextInt(); int BB = 0; int WW = 0; int BW = 0; int WB = 0; int QB = 0; int QW = 0; int BQ = 0; int ...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 11
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
8c1e992383b042fee404b786a2912a47
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; public class Main { private static void run() throws IOException { int n; n = in.nextInt(); int count_w = 0; int count_b = 0; int count_x...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 11
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
5bd29c95eccd84859dca04f3b92a4539
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
public class Main { public static void main(String[] args) { new Main(); } public Main() { FastScanner fs = new FastScanner(); java.io.PrintWriter out = new java.io.PrintWriter(System.out); solve(fs, out); out.flush(); } public void solve(FastScanner fs, java.io.PrintWriter out) { int ...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 11
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
4a6da2adc6e13d1aba96c5960d3548d9
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; public class Main { private static void run() throws IOException { int n; n = in.nextInt(); int count_w = 0; int count_b = 0; int count_x...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 11
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
72b171535e3e08223d5a321cdf34093b
train_109.jsonl
1639217100
You are given $$$n$$$ dominoes. Each domino has a left and a right cell. Each cell can be colored either black or white. Some cells are already colored, while some aren't yet.The coloring is said to be valid if and only if it is possible to rearrange the dominoes in some order such that for each $$$1 \le i \le n$$$ the...
256 megabytes
import java.io.*; import java.util.*; import java.util.concurrent.ThreadLocalRandom; import java.math.*; /** __ __ ( _) ( _) / / \\ / /\_\_ / / \\ / / | \ \ / / \\ / / |\ \ \ / / , \ , / / /| \ \ / / |\_ /| ...
Java
["1\n?W", "2\n??\nW?", "4\nBB\n??\nW?\n??"]
1 second
["1", "2", "10"]
NoteIn the first test case, there is only one domino, and we need the color of its right cell to be different from the color of its left cell. There is only one way to achieve this.In the second test case, there are only $$$2$$$ such colorings:BB WW and WB WB.
Java 11
standard input
[ "combinatorics", "fft", "graphs", "math", "number theory" ]
3858151e51f6c97abe8904628b70ad7f
The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of dominoes. The next $$$n$$$ lines describe dominoes. Each line contains two characters which represent the left and the right cell. Character B means that the corresponding cell is black, character W means that the cor...
2,400
Print a single integer — the answer to the problem.
standard output
PASSED
8d41a2844ab9827cceb7f91df8fea20f
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
// Piyush Nagpal import java.util.*; import java.io.*; public class C{ static int MOD=1000000007; static PrintWriter pw; static FastReader sc; static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { b...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
7083cedc46aa36cae91b65f0d0acb31c
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
// Piyush Nagpal import java.util.*; import java.io.*; public class C{ static int MOD=1000000007; static PrintWriter pw; static FastReader sc; static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { b...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
859b29f6853b4a531758f32600ee2614
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
//int /*package whatever //do not write package name here */ import java.util.*; public class Main { public static void main (String[] args) { Scanner sc=new Scanner(System.in); // Scanner sc=new Scanner(System.in); int t=sc.nextInt(); ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
54ef46cad20c4cdb01aa15ebf86c3c30
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; public class Main { public static void main(String []args) { int t; Scanner in=new Scanner(System.in); t=in.nextInt(); while((t--)!=0) { int n; n=in.nextInt(); int a,b; a=in.nextInt(); ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
777a2bdd5be479be01a8d0c71e1ec111
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; import java.io.*; public class B1608{ static FastScanner fs = null; public static void main(String[] args) { fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = fs.nextInt(); while (t-->0) { int n = fs.nextInt(); int a = fs.nextInt(); int b = ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
a3c3a23078d5b5eb1b534bedadc6b4f3
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
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; public class Main { BufferedReader in; PrintWriter out; Main() { in = new BufferedReader(new InputStr...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
1e92467c7491f3bcfd64f9fc81e7e2ab
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static int INF = 0x3f3f3f3f; public static int mod = 1000000007; public static int mod9 = 998244353; public static void main(String args[]){ try { PrintWriter o = new PrintWriter(System.out); bo...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
47fd2270c9ce46edc0d27ec159c5239f
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.Buffer; import java.util.Scanner; public class fastTemp { public static void main(String[] args) throws IOException, NumberFormatException { BufferedReader br = new BufferedReader(new InputS...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
fc3aa7ecdb7b52fa89e376280be7a70d
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; public class B_Build_the_Permutation { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
55fa5e65de65b94f523a6f018959b6da
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
// हर हर महादेव import java.util.*; import java.lang.*; import java.io.*; import java.math.BigInteger; import java.text.DecimalFormat; public final class Solution { static int inf = Integer.MAX_VALUE; static long mod = 1000000000 + 7; static void ne(Scanner sc, BufferedWriter op) throws Exceptio...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
61803f439dea94568c4f967cf935b770
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t=scanner.nextInt(); while (t--!=0){ int n= scanner.nextInt(); int a=scanner.nextInt(); int b=scanner.nextInt(); ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
e613947cdc74725cf907759001846318
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
//package com.example.lib; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.List; public class Algorithm { ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
440ec354118ca7de9f6036bd0aca2cfb
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
/*========================================================================== * AUTHOR: RonWonWon * CREATED: 12.12.2021 23:16:04 /*==========================================================================*/ import java.io.*; import java.util.*; public class B { public static void main(St...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
d9e4ab45d3195b7ae62fe91d72da43c5
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.math.*; import java.util.* ; import java.io.* ; @SuppressWarnings("unused") public class B { static final int mod = (int)1e9+7 ; static final double pi = 3.1415926536 ; static boolean not_prime[] = new boolean[1000001] ; static void sieve() { for(int i=2 ; i*i<1000001 ; i++) { if(not_...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
492a0df8e7caa6de6a7f164c3589e7fa
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.PI; import static java.lang.System.in; import static java.lang.System.out; import static java.lang.System.err; public class B { static int what(ArrayList<Integer> arr, int min, int max) { int min...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
e3af43b336849944e0fc6df9b3544979
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; import java.io.*; public class tr0 { static PrintWriter out; static StringBuilder sb; static long mod = (long) 998244353; static long inf = (long) 1e16; static int n, m; static ArrayList<Integer>[] ad; static int[][] remove, add; static int[][][] memo; static boolean vis[]; ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
c3179375142cc7eeec07ad9f66488b5e
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class B{ static final int up = -1, down = 1; public static void main(String[] args) throws IOException{ // br = new BufferedReader(new FileReader(".in")); // out = new PrintWriter(new FileWriter(".out")); // new Thread(...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
1717e37e9e206e722ef39fa14d5459da
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.System.*; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; public class pre1{ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
415039c37cbf23ccd7f8959bdfc23a68
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static void swap(int[] P, int idx1, int idx2) { int tmp = P[idx1]; P[idx1] = P[idx2]; P[idx2] = tmp; } public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(Sy...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
3c732ee256e352148b4eff1c5a1e58a0
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.lang.*; import java.io.InputStreamReader; import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.File; import java.io.PrintStream; import java.io.PrintWriter; import java.math.BigInteger; pu...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
3139854a26daa06013832916c782b94f
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Pentagram { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int tc = sc.nextInt(); while(tc-->0)...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
9e7e07ddd582f46905531286b519fe1f
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; public class A { static boolean[] isPrime; public static void main(String[] args) { FastScanner sc=new FastScanner(); PrintWriter pw=new PrintWriter(System.out); int ts=sc.nextInt(); while(ts-- > 0){ int n=sc.nextInt...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
d1c9daa6838acc26547dd20340e99bad
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i=1;i<=t;i++) { int n = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
46f17a290d2cce9cf8d8eefc8bf053cb
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); int t = sc.nextInt(); while(t-- > 0){ int n = sc.nextInt(); int a = sc.nextInt(); // maxima int b = sc.nextInt(...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
ba647cae8df1be37822dc5e2d10b41db
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; import java.io.*; public class practice { public static void solve() { Reader sc = new Reader(); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while(t-- > 0) { int n = sc.nextInt(); int a = sc.nextInt(); ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
565817f7011ca2298d9a1247789c32f6
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; public class CSESProblemSets { public static void main (String[] args) { int T = in.nextInt(); for(int testCase = 0; testCase < T; testCase ++){ solve(); out.flush(); } out.close(); } static void sol...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
56f8637b2731922c3d33ab1059904ba4
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; public class BuildThePermutation { static void display(Vector<Integer> x){ PrintWriter pw = new PrintWriter(System.out); for (int i=0; i<x.size() ;i++) pw.print(x.elementAt(i)+" "); pw.println(); pw.flush(); } publi...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
4384126297a1dd2d38ee7bc2b2080e74
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; public class BuildThePermutation { static void display(Vector<Integer> x){ for (int i=0; i<x.size() ;i++) System.out.print(x.elementAt(i)+" "); System.out.println(); } public static void main(String[] args){ Scanner sc = new Scanner(System.in)...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
99a5d7c716a7f6a062ef58cbdc54bc30
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int t = sc.nextInt(); while(t-->0){ int n ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
357ac588cbd480f74a3c5a8cecfc10b2
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; import java.util.concurrent.LinkedTransferQueue; //import javax.swing.plaf.basic.BasicInternalFrameTitlePane.SystemMenuBar; import java.lang.*; import java.io.*; public class Main { public static class FastReader { BufferedReader b; StringTokenizer s; public FastReader() {...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
c296b0c05495b85126c389af48a0de93
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String[] args) throws IOException { int n, counter, a,b, m, sum, p1, p2, t, k; BufferedReader...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
dced57c5b11f609ddf0503a5e3ec0282
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
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 br = new BufferedReader(new InputStreamReader(System.in)); int test = Integer.parseInt(br.readLine()); String[] inpu...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
16bb253051bff9176b4d5acee0817248
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; public class cp { static PrintWriter w = new PrintWriter(System.out); static FastScanner s = new FastScanner(); static int mod = 1000000007; static class Edge { int src; int wt; int nbr; Edge(int src, int nbr, int ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
3021bc4691e421e575e9b33c541600c4
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
/* I am dead inside Do you like NCT, sKz, BTS? 5 4 3 2 1 Moonwalk Imma knock it down like domino Is this what you want? Is this what you want? Let's ttalkbocky about that :() */ import static java.lang.Math.*; import java.util.*; import java.io.*; public class x1608B { public static void main(String...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
2118ff6c5728f388704e1bc1c922bbee
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
//package CodeForces.RoadMap.diff1200; import java.util.*; /** * @author SyedAli * @createdAt 12-03-2022, Saturday, 17:50 */ public class BuildPermutation { private static Scanner s = new Scanner(System.in); private static void solve() { int n = s.nextInt(); int a = s.nextInt(...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
537346c5cd56247fc886c471ebd603fb
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; public class BuildPermutation { public static void main(String[] args) throws IOException { FastIO fr = new FastIO(); PrintWriter pr = new PrintWriter(new OutputStreamWriter(System.out)); int t = fr.nextInt(); while (t-- > 0) { ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
c18211a8ab67cd80532284a8717e392d
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import static java.lang.Math.*; // Sachin_2961 submission // public class CodeforcesA { public void solve() { int n = fs.nInt(), a = fs.nInt(), b = fs.nInt(); if( a+b+2 > n || abs(a-b)>1){ out.println("-1"); ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
f389b88896e974211e2cdd57edd6c332
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.math.*; import java.net.Inet4Address; import java.util.*; public class sampleEditor_codeforces { static int mod=1000000007; static int mod2=1000003; static Scanner sc = new Scanner(System.in); static class Pair implements Comparable<Pair>{ int x; int y;...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
e8f2ebd575f00fd13ac852856ff77593
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.Scanner; import java.lang.Math; public class BuildthePermutation { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int j = 0; j<t; j++) { int n = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int k = ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
877f84891ca79bacf28a884981a6f06f
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.*; import java.util.stream.Stream; public class Program { static BufferedReader reader = new BufferedReader(new InputStreamReade...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
9bec6224298e89583026891a29551b90
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /** * @author Naitik * */ public class Main { static FastReader sc=new FastReader(); static long dp[]; //static int v[][]; // static int mod=998244353;; static int mod=1000000007; static int max; static int bit[]; //sta...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
4e610024dabcf5d47c0c596f477a6dc3
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; import java.io.*; public class Omar { static PrintWriter pw = new PrintWriter(System.out); static Scanner sc = new Scanner(System.in); public static void main(String[] args) throws IOException { int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(),a=sc.nextInt(),b=sc.nextInt...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
05a7aed4db154219f832e7f6472a5c02
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map.Entry; import java.util.PriorityQueue; imp...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
d2051601728682044e8b5062f2923361
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; public class A { //--------------------------INPUT READER---------------------------------// static class fs { public BufferedReader br; StringTokenizer st = new StringTokenizer(""); public fs() { this(System.in); } public fs(Inpu...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
94b1d65a96a805b4c0d0485786c994a4
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
//package codeforce.div2.r758; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Collections; import java....
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
d0bf12da6cf8329b88128413ea11a496
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
/* Challenge 1: Newbie to CM in 1year (Dec 2021 - Nov 2022) 🔥 5* Codechef Challenge 2: CM to IM in 1 year (Dec 2022 - Nov 2023) 🔥🔥 6* Codechef Challenge 3: IM to GM in 1 year (Dec 2023 - Nov 2024) 🔥🔥🔥 7* Codechef Goal: Become better in CP! Key: Consistency! */ // New Concept: Derangements...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
9086f37a3728bf707ce3ef762ac8d856
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; public class maxima { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int t,j,i,n,a,b,p,q; t=sc.nextInt(); for(j=1;j<=t;j++){ n=sc.nextInt(); a=sc.nextInt(); b= sc.nextInt(); p=1;...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
e683d892f736073ecc2b3e44c4f17d11
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; public class Main { public static void main(String []args) { int t; Scanner in=new Scanner(System.in); t=in.nextInt(); while((t--)!=0) { int n; n=in.nextInt(); int a,b; a=in.nextInt(); ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
3af4dc7e30db98e7eedcf3482339c839
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.Scanner; public class _08_Build_The_Permutation { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int test=Integer.parseInt(sc.next());sc.nextLine(); for(int i=0;i<test;i++) { String inputSplit[]=sc.nextLine().split(" "); int n=Integer.parseInt(i...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
3e1c842913992a93e76cfaf5698c9791
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.io.*; import java.util.*; //import javafx.util.*; public class Main { static PrintWriter out = new PrintWriter(System.out); static StringBuilder ans=new StringBuilder(); static FastReader in=new FastReader(); static ArrayList<Integer> g[]; //static ArrayList<ArrayList<TASK>> t; ...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output
PASSED
a2c310556e0cca602d06029ea780ea52
train_109.jsonl
1639217100
You are given three integers $$$n, a, b$$$. Determine if there exists a permutation $$$p_1, p_2, \ldots, p_n$$$ of integers from $$$1$$$ to $$$n$$$, such that:There are exactly $$$a$$$ integers $$$i$$$ with $$$2 \le i \le n-1$$$ such that $$$p_{i-1} &lt; p_i &gt; p_{i+1}$$$ (in other words, there are exactly $$$a$$$ lo...
256 megabytes
import java.util.*; import java.io.*; public class MySolution { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int test=sc.nextInt(); while(test>0) { int n=sc.nextInt(); int a=sc.nextInt(); int b=sc.nextInt(); int arr[]=new int[n]; for(int i=0; i<n; i+...
Java
["3\n4 1 1\n6 1 2\n6 4 0"]
1 second
["1 3 2 4\n4 2 3 1 5 6\n-1"]
NoteIn the first test case, one example of such permutations is $$$[1, 3, 2, 4]$$$. In it $$$p_1 &lt; p_2 &gt; p_3$$$, and $$$2$$$ is the only such index, and $$$p_2&gt; p_3 &lt; p_4$$$, and $$$3$$$ the only such index.One can show that there is no such permutation for the third test case.
Java 8
standard input
[ "constructive algorithms", "greedy" ]
2fdbf033e83d7c17841f640fe1fc0e55
The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The description of test cases follows. The only line of each test case contains three integers $$$n$$$, $$$a$$$ and $$$b$$$ ($$$2 \leq n \leq 10^5$$$, $$$0 \leq a,b \leq n$$$). The sum of $$$n$$$ over all ...
1,200
For each test case, if there is no permutation with the requested properties, output $$$-1$$$. Otherwise, print the permutation that you are found. If there are several such permutations, you may print any of them.
standard output