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
edc5e2c2a131b5f6f925bb7b8121ecf8
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.io.*; import java.util.HashMap; import java.util.Locale; import java.util.StringTokenizer; public class div2_281_A implements Runnable { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") == null; BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer("...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
d621e80a190dabf400ec0f5e231a0cbc
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.*; import java.math.*; import java.io.*; /** * * @author magzhan */ public class Cf { /** * @param ...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
82a14ba2d09db16400b09d0ec7fb460f
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner in = new Scanner(System.in); StringBuilder out = new StringBuilder(); HashMap<Integer, String> mapH = new HashMap<Integer, String>(); HashMap<Integer, String> mapA = new HashMap<Integer, String>...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
65999a7d49af539c0ba6bc9b44b1ff7a
train_001.jsonl
1417618800
Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically receives a red card.Vasya is watching a recorded football match now and makes notes of all the fouls that ...
256 megabytes
import java.util.HashSet; import java.util.Scanner; public class ProblemA { public static void main(String[] args){ Scanner scan = new Scanner(System.in); String home = scan.next(); String away = scan.next(); int fouls = scan.nextInt(); HashSet<String> hasYellow = new Has...
Java
["MC\nCSKA\n9\n28 a 3 y\n62 h 25 y\n66 h 42 y\n70 h 25 y\n77 a 4 y\n79 a 25 y\n82 h 42 r\n89 h 16 y\n90 a 13 r"]
2 seconds
["MC 25 70\nMC 42 82\nCSKA 13 90"]
null
Java 7
standard input
[ "implementation" ]
b1f78130d102aa5f425e95f4b5b3a9fb
The first line contains the name of the team playing at home. The second line contains the name of the team playing away. Both lines are not empty. The lengths of both lines do not exceed 20. Each line contains only of large English letters. The names of the teams are distinct. Next follows number n (1 ≤ n ≤ 90) — the ...
1,300
For each event when a player received his first red card in a chronological order print a string containing the following information: The name of the team to which the player belongs; the player's number in his team; the minute when he received the card. If no player received a card, then you do not need to print...
standard output
PASSED
95ff969d4ebb64c0474591303fd9c07a
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.util.*; import java.io.*; public class e { static final FS sc = new FS(); static final PrintWriter pw = new PrintWriter(System.out); static int n, m, n1, n2, n3; static ArrayDeque<Integer>[] edges; static int[] col; static ArrayDeque<Integer> ad0, ad1; static ArrayList<pair> al; static int N; sta...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
6f768a038f74b709db53c7b5a4655e49
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.util.*; import java.io.*; public class D2E { public static void main(String[] args) throws Exception{ // TODO Auto-generated method stub BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringTokenizer st = new Strin...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
db2a65ed13253580e2e2e92c83efd284
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
41ac59cbd75b303886ddae47c861eb62
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
//make sure to make new file! import java.io.*; import java.util.*; //wrong, assumes there is only 1 component public class E87b{ public static ArrayList<ArrayList<Integer>> adj; public static int[] parity; public static void main(String[] args)throws IOException{ BufferedReader f = new BufferedRead...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
3103aad7b6cc0a74cee96f743c114056
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new Da...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
c546b3fb1753914cdb88dd0906b046f5
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.io.*; import java.util.*; public class tr1 { static PrintWriter out; static StringBuilder sb; static int n, m, k, ones, zeros; static long mod = 998244353; static Boolean[][] memo; static String s; static ArrayList<Integer>[] ad; static long inf = Long.MAX_VALUE; static int N = 1 << 20 + 1; stati...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
e56000b58ebcb5b9ff24ff0899abc4ed
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet;...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
caabafcd7f90bb5f9931849a9f229df5
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.io.Writer; i...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
770520352e61ce3ee2ca39bec78458ac
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.util.*; import java.io.*; import java.text.*; public class Main { //SOLUTION BEGIN //Into the Hardware Mode void pre() throws Exception{ } void solve(int TC) throws Exception{ int n = ni(), m = ni(); int n1 = ni(), n2 = ni(), n3 = ni(); int[] from = new int[m], to = ...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
cf5f1b03173fe403f052adb4c852b6ac
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static class Node{ int idx,s1,s2; public Node(int idx,int s1,int s2){ this.idx=idx; this.s1=s1; this.s2=s2; } } static int ans[],s1,s2,cnt; static Node node[]; static boolean dp[][]; static ArrayList<Integer> adj[]; public static void main(S...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
847c4305f7ff7d44c4e8bc720c0aab93
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.io.*; import java.util.*; public class Sol{ static class pair { int x; int y; int id; public pair(int x, int y) { this.x = x; this.y = y; } } public static boolean tot[][]; public static int n,m,odd; public static List<Integer> adj[]; public static int color[] = new int[3]; public sta...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
6e8e6d35debd45faa2a4f84d04b222b0
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
// package CodeForces; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.InputMismatchException; import java.util.LinkedList; public class EducationalRound87E { public static LinkedList<Integer>[] adj...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
73453b626f949a636c245ceaed9bcb98
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.awt.Point; public class Main { //static final long MOD = 998244353L; //static final long INF = 1000000000000000007L; static final long MOD = 1000000007L; static final int INF = 1000000007; public static void main(String[] args) { FastScann...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
424236b37a63240b7118d860a77a3559
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static class node{ int a, b; public node(int x, int y){ a = x; b = y; } } static ArrayList<ArrayList<Integer>> arr = new ArrayList<ArrayList<Integer>>(); static ArrayList<node...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
3f882a77e0ad7dbfd6925157dc674c89
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
/* If you want to aim high, aim high Don't let that studying and grades consume you Just live life young ****************************** If I'm the sun, you're the moon Because when I go up, you go down ******************************* I'm working for the day I will surpass you https://www.a2oj.com/Ladder16.html */ impor...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
6b085d279ecfc3340385ff7b13d81dbe
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
/* If you want to aim high, aim high Don't let that studying and grades consume you Just live life young ****************************** If I'm the sun, you're the moon Because when I go up, you go down ******************************* I'm working for the day I will surpass you https://www.a2oj.com/Ladder16.html */ impor...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
4340b42eb7b4543bbda4691e4ff17b40
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); static int MOD = 1000000007; public static void main(String[] args) throws IOException { ...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
a896aad4a72faeff60115b4b2d548755
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class Solution { public static void main(String[] args) throws IOException { Reader rd = new Reader(); int n = rd.nextInt(), m = rd.nextInt(); int n1 = rd.nextInt(), n2 = rd.nextInt(), n3 = rd.nextInt(); HashSet<Inte...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
f177d416d0a9d00dd48103859d8a1aaa
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } long mod=998244353L; int[][] dir=new int[][] {{0,1},{1,0},{0...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
b09b19a9bef26c001aaed7c20ffbd3b9
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.io.*; import java.text.*; import java.util.*; import java.math.*; public class template { public static void main(String[] args) throws Exception { new template().run(); } boolean[] b, vis; ArrayList<Integer>[] adj; ArrayList<Integer>[][] comp; public void run() throws Exception { FastScanner f = ...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
019251df17543fd33fd82fc1148ee28d
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; public class E { //...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
c3ecf0bc725f0e003176fd7846599ce1
train_001.jsonl
1589707200
You are given an undirected graph without self-loops or multiple edges which consists of $$$n$$$ vertices and $$$m$$$ edges. Also you are given three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$.Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that: Each vertex should be labeled by exactly on...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.stream.IntStream; import java.util.InputMismatchException; import java.util.HashMap; import java.util.OptionalInt; import java.util.ArrayList; import java.util.HashSet; import java.util.Map; import java.io.OutputStream...
Java
["6 3\n2 2 2\n3 1\n5 4\n2 5", "5 9\n0 2 3\n1 2\n1 3\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5"]
2 seconds
["YES\n112323", "NO"]
null
Java 8
standard input
[ "dp", "dfs and similar", "graphs" ]
52c634955e1d78971d94098ba1c667d9
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 5000$$$; $$$0 \le m \le 10^5$$$) — the number of vertices and edges in the graph. The second line contains three integers $$$n_1$$$, $$$n_2$$$ and $$$n_3$$$ ($$$0 \le n_1, n_2, n_3 \le n$$$) — the number of labels 1, 2 and 3, respectively. It's gu...
2,100
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length $$$n$$$ consisting of 1, 2 and 3. The $$$i$$$-th letter should be equal to the label of the $$$i$$$-th vertex. If there is no valid labeling, print "NO" (without quotes).
standard output
PASSED
8b82fd92d5ada70daa401aeeeb61986a
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args)throws IOException { FastReader f=new FastReader(); StringBuffer sb = new StringBuffer(); int test=f.nextInt(); while(test-->0) { int n=f.nextInt(); int count=0,ans=0; int odd=0,b=0; ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
83f04d769614fbd5ba2451687ff9662d
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
/** * ******* Created on 6/11/19 4:55 AM******* */ import java.io.*; import java.util.*; public class B1251 implements Runnable { class Pair{ int a, b,c; public Pair(int a ,int b){ this.a= a; this.b =b; this.c = Math.abs(a-b); } } private void ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
1086e1d8b7e1b9cdb4dfc2a475f7155e
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputReader scan = new InputReader(); StringBuilder res = new StringBuilder(); int t = scan.nextInt(); while (t-- > 0) { int n = scan.nextInt(); int[] ar = new int[n]; int one = 0; ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
5e416e77203865c5866efbcae4670df4
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; /** * Created by himanshubhardwaj on 24/10/19. */ public class B { public static...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
4be47a4afb2edb532383cec569047898
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.math.*; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); for(int t=sc.nextInt();t>0;t--) { int n=sc.nextInt(); int one=0,zero=0; int ji=0,ou=0; for(int i=0;i<n;i++) { Strin...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
88f07d14e7694991d442c32aeff2359e
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.Writer; import java.io.OutputStreamW...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
d7bb846f4341c30bc71f720c0296358f
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.Scanner; import java.math.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n=in.nextInt(); for(int jk=0;jk<n;jk++){ int m=in.nextInt(); int put=0; int flag=0; for(int i=0;...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
2ad0cd7fffb7e349083e5b9ddd098367
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.Scanner; public class test { public static void main(String[] args){ Scanner in1 = new Scanner(System.in); int Q = in1.nextInt(); while (Q != 0) { Q--; int n = in1.nextInt(); int x = 0, y = 0; for (int i = 0; i < n; i++) { String st = in1.next(); if (st.length() % 2 == 1) ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
57e63a5bd13702d045b8a7b0efe33267
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.Scanner; public class Test { public static void main(String[] args) { int Q,n; int odd =0; int imperfect =0; Scanner sc = new Scanner(System.in); Q = sc.nextInt(); for(int i =0;i<Q;i++){ imperfect =0;odd =0; n = sc.n...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
8ca057e3b51fda9ae7c7a05046da2465
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class BinaryPalindromes { static Scanner sc = new Scanner(System.in); static PrintWriter pw = new PrintWriter(System.out); private static void solve() { int n = sc.nextInt(); int even = 0, odd = 0; for(int i = 0; i < n; i...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
a18df5705d3c5f2b6123838eacab7d3d
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Integer.min; public class Solution { public static void main(String[] args) throws IOException { // System.setIn(new FileInputStream("input.txt")); // System.setOut(new PrintStream(new FileOutputStream("output.txt"))); ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
eadd21ec07fc73d73746859e8286c546
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class BinaryPalindrome { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int tt=0;tt<t;tt++) { int n = sc.nextInt(); int zero = 0; in...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
6eab6e16d7f9f2286633b7673ce8885e
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.Scanner; public class test { public static void main(String[] args){ Scanner in1 = new Scanner(System.in); int Q = in1.nextInt(); while (Q != 0) { Q--; int n = in1.nextInt(); int x = 0, y = 0; for (int i = 0; i < n; i++) { String st = in1.next(); if (st.length() % 2 == 1)...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
84c9e0908423e5a9968921e9f9ba3e76
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.*; import java.io.*; public class BinaryPalindromes { public static void main(String[] args) { FastScanner scanner = new FastScanner(); PrintWriter out = new PrintWriter(System.out,false); int q = scanner.nextInt(); while(q-->0) { int n = scanner.nextInt...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
9d24f28f9429ccd200c64b34811fc03b
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.*; public class Main { static PrintWriter pw; static HashMap<Character, HashSet<Character>> adj; static StringBuilder sb; static boolean[] visit; static void dfs(char c) { visit[(int)c-(int)'a']=true; sb.append(c); for(char x: adj.get(c)){ ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
f2f86284a62fb49af9cd3d4b183b9a95
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Solution implements Runnable { static class InputReader { private InputStream stream;private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCha...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
de4933c5ae757598a0a6a9d0f03ff4de
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.Scanner; public class TaskB { public static void main(String[] args) { Scanner s = new Scanner(System.in); int q = s.nextInt(); while(q-- > 0) { int n = s.nextInt(); int zero = 0; int one = 0; int[] lengths = new int[n]; for(int i=0;i<n;i++) { char[] str = s.next()...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
e00ad6ac56101b1fb067071e851cc391
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.*; import javax.lang.model.util.ElementScanner6; import java.io.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader inp = new InputReader(inputStream); Prin...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
35afcdfffe50cd26d2c1c08011aad5d4
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHel...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
c91f15e28caab52d4c5d63a6a61f9b2d
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class p1251B { public void realMain() throws Exception { BufferedReader fin = new BufferedReader(new InputStreamReader(System.in), 1000000); String in = fin.readLine(); String[] ar = in.split(" "); int T = Integer.parseInt(ar[0]); for(int ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
2ed8e24d035636da47d77fc4af1b997f
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class ProblemB { public static void main(String[] args) { InputStream inputStream = Syst...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
fe7a9c701a50730a52b094895f40db41
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Solution implements Runnable { static class InputReader { private InputStream stream;private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCha...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
e649f0eac075e9115f0d3b473dd3563c
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); while(t != 0){ t--; int n = input.nextInt(); int flag = 0 , cnt =0; ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
934a918fa30eafa03a0e2bb32cd96df4
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.*; import java.io.*; public class Main { void solve(InputReader in, PrintWriter out) { int q = in.nextInt(); while (q-->0) { int n = in.nextInt(); int ans = 0; int alt = 0; int odd = 0; for (int i = 0; i < n; ++i) { int[] cnt = new int[2]; char...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
d1faf8fe471ded484b5f2d95480ba0c8
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; /* * */ public class E75B implements Runnable{ public static void main(String[] args) { new Thread(null, new E75B(),"Main",1<<27).start(); } @Override public void run() { FastRea...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
49a7e99af03ba53e9441d5ad87446e81
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer tk; public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(System.out); int q = nextInt...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
d6435ea989807001f1ed4bc962093dc3
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.Scanner; public class BBB { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int t=scan.nextInt(); for(int i=0;i<t;i++){ int n=scan.nextInt(); String ar[]=new String[n]; for(int j=0;j<n;j++) { ar[j]=scan.next(); } int ones=0; int zeros=0; ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
77471bde56ac92f358fcd53993c48e82
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args)throws IOException { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); int q = in.nextInt(); int n; String s; boolean odd; int val; int len; ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
04f055e5fbb6f5ac220783341a20c427
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { try { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int q = Integer.parseInt(reader.readLine()); for(int i=0; i < q; ++i) { ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
80d8661212bcf2e92935de02c1ae18e9
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ static class pair implements Comparable<pair>{ int a,b; pair(int x,int y){ a=x;b=y; } public int compareTo(pair t){ if(t.a==this.a) return this.b-t.b; return this.a-t.a; ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
97d51ffbaaa8d2f57620fd0ac9e7d9d8
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.Scanner; public class A { static int countZeroAndOne(String[] s) { int zeroCount = 0; int oneCount = 0; int totalLength = 0; int noOfOddString = 0; for (int i = 0; i < s.length; i++) { String temp = s[i]; if (temp.length() % 2 == ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
b18bdb9467d0be3848fedca7a2f67c0e
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class B2 { static int N; static char c[][]; static int dp[][]; static int total; static int lenUntil[]; public static void ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
b19fc16bac24ead04c60be542618db46
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int nt = sc.nextInt(); for (int test = 0; test < nt; ++test) { int n = sc.nextInt(); int num0 = 0, num1 = 0, numOdd = 0, numEven = 0; for (int i = 0; i < n; ++i) { String s = sc...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
4b3f50ffc3521e93429fcfe0dcc6d871
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader( ...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
7aeecaca4a02874585b80899bf6ce242
train_001.jsonl
1571929500
A palindrome is a string $$$t$$$ which reads the same backward as forward (formally, $$$t[i] = t[|t| + 1 - i]$$$ for all $$$i \in [1, |t|]$$$). Here $$$|t|$$$ denotes the length of a string $$$t$$$. For example, the strings 010, 1001 and 0 are palindromes.You have $$$n$$$ binary strings $$$s_1, s_2, \dots, s_n$$$ (each...
256 megabytes
import java.io.*; import java.util.*; import java.util.regex.*; public class vk18 { public static void main(String[]stp) throws Exception { Scanner scan=new Scanner(System.in); //PrintWriter pw = new PrintWriter(System.out); //BufferedReader br = new BufferedReader(new InputStreamReader(System...
Java
["4\n1\n0\n3\n1110\n100110\n010101\n2\n11111\n000001\n2\n001\n11100111"]
2 seconds
["1\n2\n2\n2"]
NoteIn the first test case, $$$s_1$$$ is palindrome, so the answer is $$$1$$$.In the second test case you can't make all three strings palindromic at the same time, but you can make any pair of strings palindromic. For example, let's make $$$s_1 = \text{0110}$$$, $$$s_2 = \text{111111}$$$ and $$$s_3 = \text{010000}$$$....
Java 8
standard input
[ "greedy", "strings" ]
3b8678d118c90d34c99ffa9259cc611f
The first line contains single integer $$$Q$$$ ($$$1 \le Q \le 50$$$) — the number of test cases. The first line on each test case contains single integer $$$n$$$ ($$$1 \le n \le 50$$$) — the number of binary strings you have. Next $$$n$$$ lines contains binary strings $$$s_1, s_2, \dots, s_n$$$ — one per line. It's gu...
1,400
Print $$$Q$$$ integers — one per test case. The $$$i$$$-th integer should be the maximum number of palindromic strings you can achieve simultaneously performing zero or more swaps on strings from the $$$i$$$-th test case.
standard output
PASSED
16a09031ad9b563c490b2442db78b201
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int h = sc.nextInt(); int m = sc.nextInt(); int hunger = sc.nextInt(); int d = sc.nextInt(); int cost = sc.nextInt(); int n = sc.nextInt(); double cc =0,c1=0; if (h>=20) { ...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
a122855ca6948c27300b6f35c636b46a
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.PriorityQueue; import java.util.Set; import java.util.StringTokenizer; import java.util....
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
f94083036fba5e40a0e5537bc18885b4
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
32f7683b760f01dfed8bf06ac0c166f1
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; /** * * @Maher Taho */ public class Level { public static int getTime(int hh,int mm){ int result=0; int h=20-hh-1; int m=60-mm; result=h*60+m; return result; } p...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
7cd6f5e274a7aa2622dbf237202d1f18
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.awt.List; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java....
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
bed1fee22f87a899da90bc17396950bb
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.awt.List; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java....
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
1cb74b2f84a6c06f063e39687454692e
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class A471 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int ho = sc.nextInt(); int mi = sc.nextInt(); int hu = sc.nextInt(); int d = sc.nextInt(); int c = sc.nextInt(); int n = sc.nextInt(); int t = 0; if(ho<20) { t = 60-mi + 60...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
ea33720db0c5882e660a422422a1c48f
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class feedCat { public static void main(String[] args) { Scanner in = new Scanner(System.in); int hours = in.nextInt(); int minutes = in.nextInt(); double H = in.nextDouble(); double D = in.nextDouble(); int C = in.nextInt(); ...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
402da5c4e9bec6f1030e3b81317b48a6
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { double hh, mm, H, D, C, N, ris; Scanner scanner = new Scanner(System.in); hh = scanner.nextDouble(); mm = scanner.nextDouble(); H = scanner.nextDouble(); D = scanner.nextDouble(); ...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
ba1995c16c4c3f0cc00e1493b9e269ee
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
//Author: Patel Rag //Java version "1.8.0_211" import java.util.*; import java.io.*; public class Main { public static Integer hh; public static Integer mm; static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
77f7fc50eb706f6db557ae047c60ac5d
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.StringTokenizer; public class Main { static double H, D, C, N; static int hh, mm; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
61ce045ab0dfb826febbd763b9cbd46c
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class ProbA { public static void main(String[] agrs) { Scanner input = new Scanner(System.in); double hours = input.nextInt(); double minutes = input.nextInt(); double hunger = input.nextInt(); double hungerPerMinute = input.nextInt()...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
a588b51d97cf7a8b44b3bf4cf3e39c48
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.awt.Point; import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.*; import java.util.*; public class Main { ////// static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedRe...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
df16e7f26267a000d473732d8a046547
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
d4d12cc9c6a6f677b5cdadcb1c095f4d
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class A { public static void main(String[] sachin32) { Scanner in = new Scanner(System.in); int hh = Integer.parseInt(in.next()); int mm = Integer.parseInt(in.next()); int H = in.nextInt(); int D = in.nextInt(); int C = in.nextInt(); int N = i...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
99dd4311b0dd029246ca74b808efe497
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class third471Div2 { public static void main (String [] args){ Scanner sc = new Scanner( System.in); int hh = sc.nextInt(); int mm = sc.nextInt(); int leftTime = (20-hh-1)*60 + (60-mm); double H= sc.nextInt(); double D= sc.nextInt(); ...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
a94630de7d7616c22e52577458ed8ce7
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s=new Scanner(System.in); int h=s.nextInt(); int m=s.nextInt(); int ch=s.nextInt(); int d=s.nextInt(); double c=s.nextDouble(); int n=s.nextInt(); if(h<20) { int n...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
ff10aef4b50b63f8cb1efd17d95bb4b4
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class codechef1 { public static void main(String args[]) { Scanner scan=new Scanner(System.in); int hh=scan.nextInt(); int mm=scan.nextInt(); int H=scan.nextInt(); int D=scan.n...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
4fa94c5143778216b5388701115eeb55
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) { // String s=fs.next(); //char c[]=s.toCharArray(); //int len=s.length(); InputStream in=System.in; FastScanner fs=new FastScanner(in); PrintWriter out=new Prin...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
e6be763bbac49e0a01fad5b6ee69671c
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.util.Scanner; public class problem955A { public static void main(String[] args) { Scanner console = new Scanner(System.in); int h = console.nextInt(); int m = console.nextInt(); int hunger = console.nextInt(); int hungerIncr = console.nextInt(); int cost = console.nextInt(); int hungerDe...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
d53e4c8e339417dd609d6cf990f854f0
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Scanner; public class comp1 { public static void main(String[] args){ Scanner inp = new Scanner(System.in); String hour = inp.next(); String min = inp.next(); int hunger = inp.nextInt(); int ...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
3c74368a6ec404dd6d17c30e76b6071d
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * @author khokharnikunj8 */ public class Main { public static void main(String[] args) { ...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
3bbb81484d40a93f9a449d10abfca69d
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * @author khokharnikunj8 */ public class Main { public static void main(String[] args) { ...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
2b2925772e40dc4144d76b6d18a18eb0
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
import java.io.*; import java.lang.*; import java.text.DecimalFormat; import java.util.*; public class Codeforces { static InputReader in = new InputReader(System.in); static FastReader fr = new FastReader(); static OutputWriter out = new OutputWriter(System.out); static int MOD = 1000000007, prime[]; static lo...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
5be89bd035988957a11b237bf0bd142e
train_001.jsonl
1521822900
After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is H points, moreover each minute without food increases his hunger by D points.At any time Andrew can visit the store where tasty buns are sold (you...
256 megabytes
/* Keep solving problems. */ import java.util.*; import java.io.*; public class CFA { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; private static final long MOD = 1000 * 1000 * 1000 + 7; private static final int[] dx = {0, -1, 0, 1}; private static final int[] dy = ...
Java
["19 00\n255 1 100 1", "17 41\n1000 6 15 11"]
1 second
["25200.0000", "1365.0000"]
NoteIn the first sample Andrew can visit the store at exactly 20:00. The cat's hunger will be equal to 315, hence it will be necessary to purchase 315 buns. The discount makes the final answer 25200 roubles.In the second sample it's optimal to visit the store right after he wakes up. Then he'll have to buy 91 bins per ...
Java 8
standard input
[ "greedy", "math" ]
937acacc6d5d12d45c08047dde36dcf0
The first line contains two integers hh and mm (00 ≤ hh ≤ 23, 00 ≤ mm ≤ 59) — the time of Andrew's awakening. The second line contains four integers H, D, C and N (1 ≤ H ≤ 105, 1 ≤ D, C, N ≤ 102).
1,100
Output the minimum amount of money to within three decimal digits. You answer is considered correct, if its absolute or relative error does not exceed 10 - 4. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if .
standard output
PASSED
c633a18e7c69224a933f514f19958f96
train_001.jsonl
1396798800
It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he remov...
256 megabytes
import java.util.*; public class CD414A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt() , k = sc.nextInt(); if(k < n / 2 || (n == 1 && k > 0)) System.out.println(-1); else if(k == n/2) { for(int i = 1 ; i <= n ; i++ ) { System.out.print(i + " "...
Java
["5 2", "5 3", "7 2"]
1 second
["1 2 3 4 5", "2 4 3 7 1", "-1"]
Notegcd(x, y) is greatest common divisor of x and y.
Java 11
standard input
[ "constructive algorithms", "number theory" ]
b85c8bfbe67a23a81bef755f9313115a
The first line of input contains two space-separated integers n, k (1 ≤ n ≤ 105; 0 ≤ k ≤ 108).
1,500
If such sequence doesn't exist output -1 otherwise output n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109).
standard output
PASSED
c226922130689cb9205a48d931d0eba1
train_001.jsonl
1396798800
It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he remov...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelp...
Java
["5 2", "5 3", "7 2"]
1 second
["1 2 3 4 5", "2 4 3 7 1", "-1"]
Notegcd(x, y) is greatest common divisor of x and y.
Java 11
standard input
[ "constructive algorithms", "number theory" ]
b85c8bfbe67a23a81bef755f9313115a
The first line of input contains two space-separated integers n, k (1 ≤ n ≤ 105; 0 ≤ k ≤ 108).
1,500
If such sequence doesn't exist output -1 otherwise output n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109).
standard output
PASSED
2340585254423eb6dc539051fa8a0744
train_001.jsonl
1396798800
It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he remov...
256 megabytes
import java.io.*; import java.util.*; public class Main{ static List<Integer> al = new ArrayList<>(); static { } private static void solver(InputReader sc, PrintWriter out) throws Exception { int n = sc.nextInt(); int k = sc.nextInt(); int mid = n/2; if(k==0){ ...
Java
["5 2", "5 3", "7 2"]
1 second
["1 2 3 4 5", "2 4 3 7 1", "-1"]
Notegcd(x, y) is greatest common divisor of x and y.
Java 11
standard input
[ "constructive algorithms", "number theory" ]
b85c8bfbe67a23a81bef755f9313115a
The first line of input contains two space-separated integers n, k (1 ≤ n ≤ 105; 0 ≤ k ≤ 108).
1,500
If such sequence doesn't exist output -1 otherwise output n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109).
standard output
PASSED
774b126c6dbb3b0e92bef009560280a1
train_001.jsonl
1396798800
It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he remov...
256 megabytes
import java.util.*; public class MashmokhandNumbers { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); if(n==1 ) { if(k==0) { System.out.println(1); return; } if(k>=1) { System.out.println(-1); return; } } ...
Java
["5 2", "5 3", "7 2"]
1 second
["1 2 3 4 5", "2 4 3 7 1", "-1"]
Notegcd(x, y) is greatest common divisor of x and y.
Java 11
standard input
[ "constructive algorithms", "number theory" ]
b85c8bfbe67a23a81bef755f9313115a
The first line of input contains two space-separated integers n, k (1 ≤ n ≤ 105; 0 ≤ k ≤ 108).
1,500
If such sequence doesn't exist output -1 otherwise output n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109).
standard output
PASSED
f806aa4629107ba5de461a034dfd2781
train_001.jsonl
1396798800
It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he remov...
256 megabytes
// package com.company; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.sql.SQLOutput; import java.util.*; public class Main { public static void main(String[] args) throws IOException { ...
Java
["5 2", "5 3", "7 2"]
1 second
["1 2 3 4 5", "2 4 3 7 1", "-1"]
Notegcd(x, y) is greatest common divisor of x and y.
Java 11
standard input
[ "constructive algorithms", "number theory" ]
b85c8bfbe67a23a81bef755f9313115a
The first line of input contains two space-separated integers n, k (1 ≤ n ≤ 105; 0 ≤ k ≤ 108).
1,500
If such sequence doesn't exist output -1 otherwise output n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109).
standard output
PASSED
d566bf2d08138521dbf901922805ba68
train_001.jsonl
1396798800
It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he remov...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public final class MashMokAndNumbersCF { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String st[] = br.readLine().spl...
Java
["5 2", "5 3", "7 2"]
1 second
["1 2 3 4 5", "2 4 3 7 1", "-1"]
Notegcd(x, y) is greatest common divisor of x and y.
Java 11
standard input
[ "constructive algorithms", "number theory" ]
b85c8bfbe67a23a81bef755f9313115a
The first line of input contains two space-separated integers n, k (1 ≤ n ≤ 105; 0 ≤ k ≤ 108).
1,500
If such sequence doesn't exist output -1 otherwise output n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109).
standard output
PASSED
7db826e9d569f09c41cf09d82c477f4e
train_001.jsonl
1396798800
It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he remov...
256 megabytes
import java.util.*; import java.io.*; public class Main { static final int M = 1000000007; static FastReader in = new FastReader(); static PrintWriter out = new PrintWriter(System.out); // static Scanner in = new Scanner(System.in); // File file = new File("input.txt"); // Scanner in = new Scanner(...
Java
["5 2", "5 3", "7 2"]
1 second
["1 2 3 4 5", "2 4 3 7 1", "-1"]
Notegcd(x, y) is greatest common divisor of x and y.
Java 11
standard input
[ "constructive algorithms", "number theory" ]
b85c8bfbe67a23a81bef755f9313115a
The first line of input contains two space-separated integers n, k (1 ≤ n ≤ 105; 0 ≤ k ≤ 108).
1,500
If such sequence doesn't exist output -1 otherwise output n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109).
standard output
PASSED
55343756d6c48fe7b609916499ff5b09
train_001.jsonl
1396798800
It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he remov...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); if (n == 1 && k == 0) { System.out.println("1"); return; ...
Java
["5 2", "5 3", "7 2"]
1 second
["1 2 3 4 5", "2 4 3 7 1", "-1"]
Notegcd(x, y) is greatest common divisor of x and y.
Java 11
standard input
[ "constructive algorithms", "number theory" ]
b85c8bfbe67a23a81bef755f9313115a
The first line of input contains two space-separated integers n, k (1 ≤ n ≤ 105; 0 ≤ k ≤ 108).
1,500
If such sequence doesn't exist output -1 otherwise output n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109).
standard output
PASSED
07ede6ec7c93fd35258b9af5ab5171f2
train_001.jsonl
1396798800
It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he remov...
256 megabytes
import java.util.*; public class MashmokhAndNumbers { public static boolean isPrime(int x) { for (int i = 2; i <= Math.sqrt(x); i++) { if (x % i == 0) { return false; } } return true; } public static void main(String[] args) { Scanner file = new Scanner(System.in); int n = file.nextInt();...
Java
["5 2", "5 3", "7 2"]
1 second
["1 2 3 4 5", "2 4 3 7 1", "-1"]
Notegcd(x, y) is greatest common divisor of x and y.
Java 11
standard input
[ "constructive algorithms", "number theory" ]
b85c8bfbe67a23a81bef755f9313115a
The first line of input contains two space-separated integers n, k (1 ≤ n ≤ 105; 0 ≤ k ≤ 108).
1,500
If such sequence doesn't exist output -1 otherwise output n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 109).
standard output
PASSED
5328ac52db4ade9a35369babf683df26
train_001.jsonl
1571236500
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells...
512 megabytes
import java.io.*; import java.util.*; public class A { FastScanner in; PrintWriter out; final int mod = 998244353; int add(int x, int y) { x += y; return x >= mod ? (x - mod) : x; } int mul(int x, int y) { return (int) (x * 1L * y % mod); } final int MAX = 3...
Java
["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"]
2 seconds
["8", "1", "102848351"]
NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here.
Java 8
standard input
[ "dp", "combinatorics" ]
76fc2b718342821ac9d5a132a03c925e
The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $...
2,600
Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$.
standard output
PASSED
bcbf74385c923ed2094c856019d9daed
train_001.jsonl
1571236500
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"]
2 seconds
["8", "1", "102848351"]
NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here.
Java 8
standard input
[ "dp", "combinatorics" ]
76fc2b718342821ac9d5a132a03c925e
The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $...
2,600
Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$.
standard output
PASSED
ecc46ff1d40ec01cda4558e8b1439de2
train_001.jsonl
1571236500
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in...
Java
["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"]
2 seconds
["8", "1", "102848351"]
NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here.
Java 8
standard input
[ "dp", "combinatorics" ]
76fc2b718342821ac9d5a132a03c925e
The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $...
2,600
Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$.
standard output
PASSED
5a29f895d5aa30896017d39886bd4928
train_001.jsonl
1571236500
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells...
512 megabytes
// practice with rainboy import java.io.*; import java.util.*; public class CF1237F extends PrintWriter { CF1237F() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1237F o = new CF1237F(); o.main(); o.flush(); } static final int MD = 998244353; int[] s...
Java
["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"]
2 seconds
["8", "1", "102848351"]
NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here.
Java 8
standard input
[ "dp", "combinatorics" ]
76fc2b718342821ac9d5a132a03c925e
The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $...
2,600
Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$.
standard output
PASSED
35cdb7a296b42accde745befa0980b27
train_001.jsonl
1571236500
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Iterator; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; imp...
Java
["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"]
2 seconds
["8", "1", "102848351"]
NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here.
Java 8
standard input
[ "dp", "combinatorics" ]
76fc2b718342821ac9d5a132a03c925e
The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $...
2,600
Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$.
standard output