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
d6ba31f3ae90cf93a324492b8aa51754
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x > y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputSt...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 8
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
6640ede22fd97bb2f7723699588e600f
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Main { static Main2 admin = new Main2(); public static void main(String[] args) { admin.start(); } } class Main2 { //---------------------------------INPUT READER-----------------------------------------// public BufferedRead...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 8
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
5bd1eff5026d817c79eb627bcc952e25
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.lang.*; import java.math.BigInteger; import java.util.*; public class Solution { public static long MOD = 998244353L; public static void main(String[] args) throws Exception { FastScanner fs = new FastScanner(); int t = fs.nextInt(); fac[0] = fac[1] = ifac[0] = 1L; for ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 8
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
3684b05a05caaff90501c8c508578cc2
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.io.*; public class tr0 { static StringBuilder sb; static int inf = (int) 1e9; static int mod = 998244353; static int n, m, k; static TreeSet<Integer>[] ad, mult; static long[][][][] memo; static long[] f, val; static HashMap<Integer, Integer> hm; static ArrayList<in...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 8
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
ae7ed8e59775fcfbc368a16e75c11ec0
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Solution { private static boolean useInFile = false; private static boolean useOutFile = false; public static void main(String args[]) throws IOException { InOut inout = new InOut(); Resolver resolver = new Resolver(inout); ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 8
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
aca2a292b6765dbe00dcf41b833809f4
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class CardGame { private static final int START_TEST_CASE = 1; private static final int MOD = 998244353; /** * Pre-compute factorial function and mod-inverse of factorial function in linear time. */ private static final long[] F = new long[222]; priv...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 8
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
44f1003f31d4f964911d248c3fd2af1c
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import static java.lang.Math.*; public class Solution { static long[] AWins = new long[61]; static long[] BWins = new long[61]; static long[] factorials = new long[61]; stati...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
775de2b3a3e417c3288e9be9eaf2c7f1
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import static java.lang.Math.*; public class Solution { static long[] AWins = new long[61]; static long[] BWins = new long[61]; static long[] factorials = new long[61]; static lo...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
05dfe9ecedab43ba0325888aaa55614f
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import static java.lang.Math.*; public class Solution { static long[] AWins = new long[61]; static long[] BWins = new long[61]; static long[] factorials = new long[61]; static lo...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
37d01b9f21eeafcdeccb630629ebbf34
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.sql.Array; import java.util.*; import java.io.*; import java.math.BigInteger; import java.util.stream.IntStream; import java.util.stream.LongStream; public class Main { public static FastReader cin; public static PrintWriter out; public static long MOD = 998244353L; public ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
dab7205cc7e26862e69cd04c03f5ecc5
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; public class Test1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while(tc-->0) { int n = sc.nextInt(); long mod = 998244353; long[] fact = new long[n+1]; fact[0] = 1; for(int i=1;i<=n;i++) ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
f11c7dd3e10e826a3b527fa955122906
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; public class Main { static Scanner sc = null; static long C[][] = new long[100][100]; static final int mod = 998244353 ; public static void main(String[] args) { sc = new Scanner(System.in); C[ 0 ][ 0 ] = 1; for (int n = 0; n <= 60; n++) { for (int k = 0; k <= n; k++) { i...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
bfdba5d755c26fa54acca5f95db402d2
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException{ new Main().run(); } void run()throws IOException{ new Solve().setIO(System.in,System.out).run(); } public class Solve extends IOTask{ ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
2aed67c72154a4e70cca7cfe7c72e1a6
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.Scanner; public class Main { private final static long mod = 998244353; private static long[] fact = new long[107]; private static long[] finv = new long[107]; private static long[] dp = new long[107]; public static void main(String[] args) { Scanner in = new Scanner(System.in); ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
e42be7ff5b0812ebb455aeb5bb21d686
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { final int mod = 998244353; Long[][] a = new Long[63][63]; a[0][0] = 1L; a[1][0] = 1L; a[1][1] = 1L; for(int i=2;i<=62;i++) { a[i][0] = a[i][i] = 1L; ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
c8cbcd6e9519dc99631adb18047f15bc
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.io.*; public class Solution { private static SuperFastReader sc = new SuperFastReader(); // private static final FastReader sc = new FastReader(); // private static final Scanner sc = new Scanner(System.in); private static PrintWriter out = new PrintWriter(System.out); ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
28dde64936836d13dfd3afebaa655404
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class C { static int mod = 998244353; public static void main(String[] args) throws IOException { // Scanner sc = new Scanner(new File("second_friend_input.txt")); // PrintWriter pw = new PrintWriter("B1_output.txt"); Scanner sc = new...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
a1716c8bb1b7c08720d08c7094429d2b
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.io.*; public class CF1737 { // For fast input output static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { try { br = new BufferedReader( new FileReader("inp...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
28766bcbac418fc2e44f5fb9bb3ae4ea
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; public class Main { static Scanner sc=null; static long C[][]=new long[100][100]; static final int mod = 998244353 ; public static void main(String[] args) { sc = new Scanner(System.in); C[ 0 ][ 0 ] = 1; for(int n = 0;n <= 60;n++) { for(int k = 0;k <= n;k++) { ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
c8f43ab24ac9ac80cc73493b5f17a574
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class RoundEdu136C { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final static String I...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
e7eda6e33593e4121f32706e161e67d5
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
//package codeForces._1739; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class c { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.p...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
d9103d3558737f2cdc20ffb9d2729363
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
/** * @author vivek * <> */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class C { // function to calculate ncr mod k static int nCrModp(int n, int r, int p) { // The array C is going to store last ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 17
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
733f88040b80c36072e822b5dadca7e3
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import static java.lang.Math.*; import static java.lang.System.*; import java.io.*; import java.util.*; public class Template{ public static void main(String[] args)throws IOException { FastReader fr = new FastReader(); int t = fr.nextInt(); int max = 6; int[] inp = new int[t];...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
883517e87e03775a673f218c14c7e2f7
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); long[][] arr = new long[61][2]; arr[2][0] = 1; arr[2][1] = 0; fo...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
3aa3f1697544e3c8ec77005b960a8806
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static int INF = 0x3f3f3f3f, mod = 1000000007, mod9 = 998244353; public static void main(String args[]){ try { PrintWriter o = new PrintWriter(System.out); boolean multiTest = true; // init ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
d4168d081319beda13353a310a222462
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static int INF = 0x3f3f3f3f, mod = 1000000007, mod9 = 998244353; public static void main(String args[]){ try { PrintWriter o = new PrintWriter(System.out); boolean multiTest = true; // init ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
9d5a976b71174c5cd8e048d4c3c8681c
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static int INF = 0x3f3f3f3f, mod = 1000000007, mod9 = 998244353; public static void main(String args[]){ try { PrintWriter o = new PrintWriter(System.out); boolean multiTest = true; // init ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
bfb1bf330e6dcda1a6f387d34a859bc0
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static int INF = 0x3f3f3f3f, mod = 1000000007, mod9 = 998244353; public static void main(String args[]){ try { PrintWriter o = new PrintWriter(System.out); boolean multiTest = true; // init ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
19fd8009e7e75e572206c47062afe569
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static final PrintWriter out =new PrintWriter(System.out); static final FastReader sc = new FastReader(); //I invented a new word!Plagiarism! //Did you hear about the mathematician who’s afraid of negative numbers?He’l...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
0f53bf9e0420ed1548b390bc72c0e9ec
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; public class C_Card_Game { static long mod = 998244353l; static long fact[] = new long[61]; static long invFact[] = new long[61]; ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
84efe1758a69bf94b3d732b224b814fe
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.io.*; public class A { static int MOD = 998244353; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int B[] = new int[61]; Arrays.fill(B, -1); while(t-->0) { int n =...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
1fe72d832eedc052a27d5f7b607e710c
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.Random; import java.util.StringTokenizer; import java.util.concurrent.ThreadLocalRandom; /*3 7, 8, */ public class CF { static final long m = 998244353; static int[][] pascal; ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
9a6f43977d1f8f23cd589e77b9ee0f24
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.lang.*; import java.math.BigInteger; import java.io.*; public class Main implements Runnable { public static void main(String[] args) { new Thread(null, new Main(), "whatever", 1 << 26).start(); } private FastScanner sc; private PrintWriter pw; ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
041c3f9e55443dbb09bba566b4ed099b
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.Scanner; public class C { static long mod=998244353; public static void main(String[] args) { Scanner stdin=new Scanner(System.in); int t=stdin.nextInt(); long[] A=new long[61]; long[] B=new long[61]; long[] D=new long[61]; long[][] nCr...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
32f032bafd41f59fa0d49becd922bbdb
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.io.*; public class Main { static long mod = 998244353; static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main(String[] args) throws IOException { FastReader sc = new FastReader(); int t = sc.nextInt(); while( t-- ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
29ff183edce917acd5e3a317d8eaa771
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.lang.*; import java.util.*; public class ComdeFormces { static int x[]= {-1,0,0,1,1,1,-1,-1}; static int y[]= {0,1,-1,0,1,-1,1,-1}; static int dp[][][][]; static int seg[]; static class Trie{ Trie a[]; int ind; public Trie() { this.a=new Trie[3]; this.ind...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
3c2264736153abc1fb8213c1df5b7cc8
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; public class C_Card_Game { static long printNcR(int n, int r) { long p = 1, k = 1; if (n - r < r) { r = n - r; } if (r != 0) { while (r > 0) { p *= n; k *...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
a6335387ae4f7606e67471cb0fccda72
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.lang.invoke.MethodHandles; import java.io.*; public class C1739C { static final int MOD = 998244353; static final Random RAND = new Random(); static Combination COMB = new Combination(60); static int[] solve(int n) { int[] ans = new int[3]; boolean ale...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
1a5dfee0fdfdaa9424d274023687fde9
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); long[][] arr = new long[61][2]; arr[2][0] = 1; arr[2][1] = 0; for(int i=...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
4f6bb015ac5a0e7eab5fcf5791ed5d83
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); long[][] arr = new long[61][2]; arr[2][0] = 1; arr[2][1] = 0; for(int i=...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
18170589883f74af5097ec691d585d09
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); static FastReader sc = new FastReader(); static long mod = 998244353;//(int)1e9+7; static int maxn = 60; static int[][] C = new int...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
7e8f5ed76225ae64d06152a748e44c36
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; public class Main2 { public static long MOD = 998244353; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
9d3ae59a92d72cd26be6fb5f997b6a7e
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.StringTokenizer; public class C { private final static String inputFileName = null; private final static String outputFileName = null; public static void main(String[] args) { try (Solver solver = new Solver(inputFileName, outputFileName)) { ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
a49fa952375e616127ed95532a7c12fe
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.StringTokenizer; public class C { private final static String inputFileName = null; private final static String outputFileName = null; public static void main(String[] args) { try (Solver solver = new Solver(inputFileName, outputFileName)) { ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
c17c6b1c1fafe32cd9ede38db81a5c09
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class C { static int mod = 998244353; public static void main(String[] args) throws IOException{ FastScanner fs = new FastScanner(); printNcR(32, 16); int tt = fs.nextInt(); outer: while(tt-- > 0) { int n = fs.nextInt(); long wi...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
87ce92a1fa432a16054e9f2d51024bfc
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; public class Solution { static Scanner scn = new Scanner(System.in); public static void main(String[] args) { int t = scn.nextInt(); int temp = t; long mod = 998244353; long[] fact = new long[61]; fact[0] = 1; fact[1] = 1; ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
fd4975fdc302870853952e73a60ba281
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main { static final int INF = 0x3f3f3f3f; static final long LNF = 0x3f3f3f3f3f3f3f3fL; static BigInteger mod=new BigInteger("998244353"); static BigInteger yi=new BigInteger("1"); public static void main(Str...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
fb9006129a069dc839322e399e40dbd0
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CardGame { static class FastScanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenize...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
253afb2c81d26103d20e8a15c81d6802
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CardGame { static class FastScanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenize...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
f31901146e32a0c587b8e8abd0b3d0d8
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.lang.reflect.WildcardType; import java.util.ArrayList; import java.util.Collections; import java.util.InputMismatchException; public class E1739C { static int MOD = 998244353; public static void main(String[] args) { FastIO io = new FastIO(); int t = io...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
2a438023ae9ac4694e33b72c2d1e641c
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Main { final static long mod=998244353; static long[][] dp=new long[1000][1000]; public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); long[][] ka=new l...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
e8d854c5b13cd5de4a6b7f1bf16eff64
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.io.*; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.math.BigInte...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
84ca2bd8725dc44bddc0d28c1ccd8366
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tok = new StringTokenizer(""); String next() throws IOException { if (!tok.h...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
1c337e5c9340f9612f3bc2d9fb07e23d
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; public class q184 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t= sc.nextInt(); while (t-->0){ int n = sc.nextInt(); cal(n+1); dp = new long[n+1][3]; dp[2][0] = 1; d...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
a36a7be0575af595c5109a0a09f60161
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; public class q184 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t= sc.nextInt(); while (t-->0){ int n = sc.nextInt(); cal(n+1); dp = new long[n+1][3]; dp[2][0] = 1; d...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
b745f003e631960207209a5b446185f2
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.sort; public class Codeforces { static long dp[][]; public static void main(String[] args) { ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
bc73a906db587166014547a84eb796ee
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); combinations=new HashMap<>(); while(t-->0){ int n = scn.nextInt(); long a=0,b=0; int an = 1, bn =...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
22af247912e1737f9cad21ccfc5e4513
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.PrintWriter; import java.util.Locale; import java.util.Scanner; public class Solution { private static final int MOD = 998_244_353; private static int[][] bin = new int[61][61]; static { for (int i = 0; i < bin...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
845d7ad6282a05ed61dc7ce4526cf3af
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.util.Map.Entry; 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.math.*; public class Simple{ public static ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
3b7e851a5017596de61c213e8aa7c03a
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class CodeForces { class FastReader{ BufferedReader br; StringTokenizer st; FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { try{ while(st == nu...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
317b3a288b1058a7f1a80bc8c5ef792a
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Codeforces { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int t=Integer.parseInt(bu.readLine()),i,N=60; ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
7e9f0ce68611c1f46c78931491592b27
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import com.sun.source.tree.Tree; import java.io.*; import java.util.*; public class Main { // private static int[][] dirs = {{-1,-1}, {1, 1}, {-1, 1}, {1, -1}}; private static int[][] dirs = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; private static long inf = (long) 1e13; private static lon...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
0368ded85c3ff29d026c8ebc2a01c67b
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
/** * @author Nitin Bhakar * */ import java.io.*; import java.util.*; public class Codeforces{ static long mod = 1000000007L; static long m = 998244353; static int ninf = Integer.MIN_VALUE; static int inf = Integer.MAX_VALUE; static void swap(int[] a,int i,int...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
7d57e70c96a0e74c597c0145266e7b9d
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.lang.*; import java.lang.reflect.Array; import java.util.*; public class Main { public static void main(String[] args) { solve(); } private static void solve() { FastReader sc = new FastReader(); int t = sc.nextInt(); while (t-- > ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
af41afa725cf80705aafafc464e4bee6
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class Main { static ContestScanner sc = new ContestScanner(System.in); static ContestPrinter pw = new ContestPrinter(System.out); static StringBuilder sb = new StringBuilder(); static long mod = 998244353; static Com...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
273d09aa2067de17a1d547176730b327
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; public class C { public static final int MOD998 = 998244353; public static final int MOD100 = 1000000007; public static void main(String[] args) throws Exception { ContestScanner sc = new ContestScanner(); ContestPrinter cp = new ContestPrinter(); int T = sc.ne...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
a378a5dc1fdb2827a7887cb9f4bb5203
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Main { static Scanner sc; static long mod = 998244353; static long fact[]; static long inverse[]; public static void main (String[] args){ sc = new Scanner(System.in); fact = new long[65]; inverse = new long[65]; fact[0] = 1; inverse...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
8a9cd04ef542a93cdb2f532196659ca3
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
/* "Everything in the universe is balanced. Every disappointment you face in life will be balanced by something good for you! Keep going, never give up." Just have Patience + 1... */ import java.util.*; import java.lang...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
091e7551c3b075fb381880c043bbd6c7
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class Main { static Scanner sc; static long mod = 998244353; static long fact[]; static long inverse[]; public static void main (String[] args){ sc = new Scanner(System.in); fact = new long[65]; inverse = new long[65]; fact[0] = 1; inverse...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
3a8ec51677361e07a2f3b67ca47b2870
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.io.*; public class Main{ static int mod = 998244353; static long fact[] = new long[65]; static long inv[] = new long [65]; static Scanner sc = new Scanner (System.in); static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); static St...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
efcc6856b7970032afc258ca182d6b55
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
/** * 09/29/22 morning * https://codeforces.com/contest/1739/problem/B */ // package codeforce.ecf.r136; import java.util.*; import java.io.*; public class C { static PrintWriter pw; final int mod = 998244353; long[] fact, ifact, inv; int N = 70; void comb_init() { fact...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
0049dfd9627c38d1a2292e0a1df4ac68
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
/* Author: Spidey2182 #: 1739C */ import java.util.*; public class CardGame implements Runnable { static ContestScanner sc = new ContestScanner(); static ContestPrinter out = new ContestPrinter(); public static void main(String[] args) { new Thread(null, new CardGame(), "mai...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
b7ab004ba33f4691761e0558090781a6
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
// Working program with FastReader import java.io.*; import java.util.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() { while (st == null...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
d7b003d071a3471c6883b2f6337a9b52
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long mod = 998244353; long [] alex = new long[31]; long [] boris = new long[31]; alex[1] = 1; boris[1] = 0; for(int i = 2; i<...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
ab2b1a42043e90b426c6c8daf2a4fe95
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class A_Two_Elevators{ static final long bluff[][]={ {1,0}, {3,2}, {12,7}, {42,27}, {153,98}, {560,363}, {2079,1352}, {7787,5082}, {29392,19227}, {111605,73150},...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
37f927d4890c6bb52d8a9add95d2234b
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static long dp1[]; static long dp2[]; static long maxi , ok; static long mod = 998244353; // static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main (String[] ar...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
73aa22949dd96882ad72994f39e99ce6
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; //public class codechef public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
5196d243ec25ea9a66621ad3600f5327
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { // your code goes here Buf...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
b54fd06dc9f8044f1a514131f0463825
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
// package c1739; // // Educational Codeforces Round 136 (Rated for Div. 2) 2022-09-29 07:35 // C. Card Game // https://codeforces.com/contest/1739/problem/C // time limit per test 2 seconds; memory limit per test 512 megabytes // public class Pseudo for 'Source should satisfy regex [^{}]*public\s+(final)?\s*class\s+(...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
198877a8fdf3d8054c1a05cff70e501e
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.lang.*; import java.io.*; public final class Main { FastReader s; // PrintWriter out ; public static void main(String[] args) throws java.lang.Exception { new Main().run(); } void run() { // out = new PrintWriter(new OutputS...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
c8d0bb4e90b574520a95b6c877aa2ad3
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; public class Main2 { public static long MOD = 998244353; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
8fdc184560e4312d19ed896f30bc8428
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import java.util.function.BinaryOperator; import java.util.stream.Collectors; public class Main { private final static long mod = 998244353; private final static int MAXN = 1000001; private stat...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
7541feff04fa53707bff932d6f447bc4
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.math.BigInteger; public final class B { static PrintWriter out = new PrintWriter(System.out); static StringBuilder ans=new StringBuilder(); static FastReader in=new FastReader(); // static int g[][]; static ArrayList<Pai...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
c009be9cf1b2e70ebc320180ef5fa7de
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; public class ProblemC { static int mod = 998244353; static long qmod(long a, long b) { long sum = 1; while (b > 0) { if (b % 2 == 1) sum = (sum * a) % mod; a = (a * a) % mod; b /= 2; } return sum; } sta...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
19c277433fbc514b839b219e2401d5cf
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
/** * Created by Himanshu **/ import java.util.*; import java.io.*; public class C1739 { static final int ALPHABET_SIZE = 26; public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(System.out); Reader s = new Reader(); int t = s.i();...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
9ba1944614ca48f40a5c0d267d1e214a
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.io.*; public class Main { private static final void solve() throws IOException { int nn = ni(), n = nn >> 1; var fa = new ModIntFactory(998244353); var x = fa.create(0); var y = fa.create(0); for (int i = nn - 1, j = n; i >= 0; i -= 4, j -= 2)...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
a20a5bcb1b633c4f201d668c67b4a663
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
/*input 5 2 4 6 8 60 */ import java.util.*; import java.lang.*; import java.io.*; public class Main { static PrintWriter out; static int MOD = 998244353; static FastReader scan; /*-------- I/O usaing short named function ---------*/ public static String ns(){return scan.next()...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
0f136e8ffc6beea8de493ac5259c8478
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.math.BigDecimal; import java.util.Scanner; public class C { static BigDecimal[][] dp = new BigDecimal[61][3]; static { dp[2][0] = new BigDecimal(1); dp[2][1] = new BigDecimal(0); dp[2][2] = new BigDecimal(1); for (int i = 4; i <=60 ; i+=2) { Bi...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
72d7bbd47655696df8ab852eb1bb0c36
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.Arrays; import java.util.*; import java.util.StringTokenizer; public class copy { static int log=30; static int[][] ancestor; static int[] depth; static int[] sieveOfEratosthenes(int n) { int prime[] = new int[n + 1]; for (int i = ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
b9047dd8054f645ef242d465fafc6910
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; /** * * @author eslam */ public class Solution { // Beginning of the solution static Kattio input = new Kattio(); static BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out)); static ArrayList<Ar...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
c414be0a7aa1148434603de596fc0610
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.math.*; public class C { public Object solve () { int N = sc.nextInt(); long H = modInv(2); long [] F = new long [N+1], G = new long [N+1]; F[2] = 1; for (int n = 4; n <= N; ++n) { long t = BIN(n, n/2); F[n] = mod(H * t + G[n-2]); G[n] = mod(t - F[n] - 1); } lon...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
f0d2ba1e9248c716025d193fd2aeae4e
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
// C. Card Game // Educational Codeforces Round 136 (Rated for Div. 2) // Codeforces // Solution by Anmol Sharma import java.util.*; import java.lang.*; import java.io.*; public class Main { public static long mod = 998244353; public static void main(String[] args) throws java.lang.Exception { ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
53aaa76532ace2d316dfeeb227a6b325
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.math.*; import java.util.*; public class C_Card_Game { public static void main(String[] args)throws Exception { new Solver().solve(); } } //* Success is not final, failure is not fatal: it is the courage to continue that counts. class Solver { ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
6d640ff85ab0ec5669dbbc23c990ca12
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
/* Author: Spidey2182 #: 1739C */ import java.util.*; public class CardGame implements Runnable { static ContestScanner sc = new ContestScanner(); static ContestPrinter out = new ContestPrinter(); public static void main(String[] args) { new Thread(null, new CardGame(), "mai...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
90e32b06e182a7dd1b5113300c7d6ac8
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class c { static long m = 998244353; public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder b = new StringBuilder(); int nc = Integer.parseInt(...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
7a9da4709f7cfccbed75fb0ee33c2a67
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.awt.geom.*; import static java.lang.Math.*; public class Solution implements Runnable { long mod1 = (long) 1e9 + 7; long mod2 = 998244353; long win[] = new long[61]; long loss[] = new long[61]; public void solve() throws E...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
2e03db08a35e076374bab4ca3a52ca16
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Stack; public class Main { static long MOD = 998244353l; int min = Integer.MAX_VALUE; int max = 0; char result[][]; int count = 0; int pattern = 0; publ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
131eb5c51133b5ff39d4b38ae1ddd036
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.*; import java.util.*; public class C { static final int INF = 998244353; public static void main(String[] args) throws IOException { StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine(...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
0d8cfedde49a0c4f36c20da0652205bc
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import j...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output
PASSED
24a1699e11cf9685f6313dd63575785e
train_109.jsonl
1664462100
Consider a game with $$$n$$$ cards ($$$n$$$ is even). Each card has a number written on it, between $$$1$$$ and $$$n$$$. All numbers on the cards are different. We say that a card with number $$$x$$$ is stronger than a card with number $$$y$$$ if $$$x &gt; y$$$.Two players, Alex and Boris, play this game. In the beginn...
512 megabytes
import java.util.*; import java.io.*; public class C { static Scanner sc = new Scanner(System.in); static PrintWriter pw = new PrintWriter(System.out); static long binomialCoeff(int n, int k) { if (n == 0 || k < 0) { return 0; } ...
Java
["5\n\n2\n\n4\n\n6\n\n8\n\n60"]
2 seconds
["1 0 1\n3 2 1\n12 7 1\n42 27 1\n341102826 248150916 1"]
NoteIn the first test case, Alex wins if he receives the card $$$2$$$ (he plays it, and Boris cannot respond). If Alex receives the card $$$1$$$, the game ends in a draw.In the second test case: Alex wins if he receives the cards $$$[3, 4]$$$, $$$[2, 4]$$$ or $$$[1, 4]$$$; Boris wins if Alex receives the cards $$$[1...
Java 11
standard input
[ "combinatorics", "constructive algorithms", "dp", "games" ]
63fc2fb08d248f8ccdb3f5364c96dac1
The first line contains one integer $$$t$$$ ($$$1 \le t \le 30$$$) — the number of test cases. Then, $$$t$$$ lines follow. The $$$i$$$-th line contains one even integer $$$n$$$ ($$$2 \le n \le 60$$$).
1,500
For each test case, print three integers: the number of ways to distribute the cards so that Alex wins; the number of ways to distribute the cards so that Boris wins; the number of ways to distribute the cards so that the game ends in a draw. Since the answers can be large, print them modulo $$$998244353$$$.
standard output