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
a7f6c72965333010a9b182de348c12a9
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.util.*; import java.awt.*; public class p828B { public static void main(String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); char[][] arr = new char[n][m]; int totalB = 0; int minX = 101; int maxX = -...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells β€” (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each β€” the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
221b2aee8229a3c4f569f6893fdd289e
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 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 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells β€” (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each β€” the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
7c3e775b4a494e826986e877282cebac
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner input = new Scanner(System.in); int n = input.nextInt(); int m = input.nextInt(); char[][] map = new char[n][m]; for(int i=0; i<n; i++){ map[i] = input.next().toCharArray(); } blackSq(map); input.close(); ...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells β€” (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each β€” the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
578b0673b8d787388891ef29f4cea260
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { FastScanner sc = new FastScanner(); PrintWriter pw = new PrintWriter(System.out); while (sc.hasNext()) { int n=sc.nextInt(); int m=sc.nextInt(); int[][]maze=new int[n][m]; int up=9999; int down=-1; ...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells β€” (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each β€” the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
3185ced382dbf0f05caa8f3110446be2
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.*; import java.util.*; public class CF828B { public static void main(String[] args)throws IOException { BufferedReader bs=new BufferedReader(new InputStreamReader(System.in)); String[] t1=bs.readLine().split(" "); int n=Integer.parseInt(t1[0]); int m=Integer.parseI...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells β€” (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each β€” the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
07a1bd32f2444ffdf74f688eec6d62ff
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
/** * @author: Mehul Raheja */ import java.util.*; import java.io.*; import static java.lang.Math.*; public class B{ /* Runtime = O() */ static int N, M, K; static String s; static StringTokenizer st; static int[] d; public static void main(String[] args) throws Exception...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells β€” (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each β€” the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
963a7c8718abe32b5f3a3b7e35880f02
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.util.Scanner; public class BlackSquare2 { public static void main(String[] args) { Scanner draw = new Scanner(System.in); int n = draw.nextInt(); int m = draw.nextInt(); String str[] = new String[n]; for (int i = 0; i < n; i++) str [i] = draw.next(); int m1 = 200 , m2 = -1 ; int ...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells β€” (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each β€” the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
1989a6a0e1832b2d4c0a96fb6704922f
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.*; import java.util.*; public class BlackSquare { static int check(String[][] s, int width, int length) { int area = width*length; int size = Math.min(length, width); int left = Integer.MAX_VALUE; int right = 0; int up = Integer.MAX_VALUE; int down = 0; int blackcount = 0; for (int i =...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells β€” (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each β€” the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
0300023d5dd9c98d641239d1df3ba99e
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Ex828 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String firstLine = br.readLine(); String[] ...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells β€” (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each β€” the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
66c476af772d95bbd6a3f0382238cab1
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] firstLineA = br.readLine().trim().split(" "...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells β€” (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≀ n, m ≀ 100) β€” the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each β€” the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
d1d60cf71b10eed67ec6d963eb8cc992
train_003.jsonl
1394465400
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot b...
256 megabytes
//package codeforces; import java.io.PrintWriter; import java.util.Scanner; public class SerejaandContests { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int x = in.nextInt(); int k = in.nextI...
Java
["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0"]
1 second
["0 0", "2 3", "5 9"]
NoteIn the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round. The maximum number of rounds equals ...
Java 7
standard input
[ "implementation", "greedy", "math" ]
fb77c9339250f206e7188b951902a221
The first line contains two integers: x (1 ≀ x ≀ 4000) β€” the round Sereja is taking part in today, and k (0 ≀ k &lt; 4000) β€” the number of rounds he took part in. Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding...
1,200
Print in a single line two integers β€” the minimum and the maximum number of rounds that Sereja could have missed.
standard output
PASSED
7242721a9802b83fdc7770cd2f64dacb
train_003.jsonl
1394465400
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot b...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner in=new Scanner(System.in); int n,k; n=in.nextInt(); k=in.nextInt(); int[] finished=new int[n]; int type; int min=0,max=0; finished[0]=1; for(int i=0;i<k;i++){ ...
Java
["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0"]
1 second
["0 0", "2 3", "5 9"]
NoteIn the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round. The maximum number of rounds equals ...
Java 7
standard input
[ "implementation", "greedy", "math" ]
fb77c9339250f206e7188b951902a221
The first line contains two integers: x (1 ≀ x ≀ 4000) β€” the round Sereja is taking part in today, and k (0 ≀ k &lt; 4000) β€” the number of rounds he took part in. Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding...
1,200
Print in a single line two integers β€” the minimum and the maximum number of rounds that Sereja could have missed.
standard output
PASSED
5af344e4b3b8dd3cdf28acbb45c2dc44
train_003.jsonl
1394465400
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot b...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int c = sc.nextInt(); int k = sc.nextInt(); boolean[] a = new boolean[c]; for (int i = 0; i < k; i++) { int a1 = sc....
Java
["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0"]
1 second
["0 0", "2 3", "5 9"]
NoteIn the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round. The maximum number of rounds equals ...
Java 7
standard input
[ "implementation", "greedy", "math" ]
fb77c9339250f206e7188b951902a221
The first line contains two integers: x (1 ≀ x ≀ 4000) β€” the round Sereja is taking part in today, and k (0 ≀ k &lt; 4000) β€” the number of rounds he took part in. Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding...
1,200
Print in a single line two integers β€” the minimum and the maximum number of rounds that Sereja could have missed.
standard output
PASSED
fe2eeea7795fbe4b0801212bf52e0364
train_003.jsonl
1394465400
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot b...
256 megabytes
import java.lang.*; import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); new Task().solve(scanner, out); out.close(); scanner.close(); } } class Task { pu...
Java
["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0"]
1 second
["0 0", "2 3", "5 9"]
NoteIn the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round. The maximum number of rounds equals ...
Java 7
standard input
[ "implementation", "greedy", "math" ]
fb77c9339250f206e7188b951902a221
The first line contains two integers: x (1 ≀ x ≀ 4000) β€” the round Sereja is taking part in today, and k (0 ≀ k &lt; 4000) β€” the number of rounds he took part in. Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding...
1,200
Print in a single line two integers β€” the minimum and the maximum number of rounds that Sereja could have missed.
standard output
PASSED
4fc5e4b1189c79b567ca3dbd31ca5254
train_003.jsonl
1394465400
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot b...
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.Arrays; import java.util.PriorityQueue; import java.util.StringTokenizer; public class Main { public static void m...
Java
["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0"]
1 second
["0 0", "2 3", "5 9"]
NoteIn the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round. The maximum number of rounds equals ...
Java 7
standard input
[ "implementation", "greedy", "math" ]
fb77c9339250f206e7188b951902a221
The first line contains two integers: x (1 ≀ x ≀ 4000) β€” the round Sereja is taking part in today, and k (0 ≀ k &lt; 4000) β€” the number of rounds he took part in. Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding...
1,200
Print in a single line two integers β€” the minimum and the maximum number of rounds that Sereja could have missed.
standard output
PASSED
1c8ac4ecac365245f9eb5e3dcd865248
train_003.jsonl
1394465400
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot b...
256 megabytes
import java.io.*; import java.util.*; public class p401b { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println(); int x = sc.nextInt(); int k = sc.nextInt(); int t=0,div1=0,div2=0,max=0,min=0; boolean[] check = new boo...
Java
["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0"]
1 second
["0 0", "2 3", "5 9"]
NoteIn the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round. The maximum number of rounds equals ...
Java 7
standard input
[ "implementation", "greedy", "math" ]
fb77c9339250f206e7188b951902a221
The first line contains two integers: x (1 ≀ x ≀ 4000) β€” the round Sereja is taking part in today, and k (0 ≀ k &lt; 4000) β€” the number of rounds he took part in. Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding...
1,200
Print in a single line two integers β€” the minimum and the maximum number of rounds that Sereja could have missed.
standard output
PASSED
df4aed6cb60afa5d2037c13d397d854a
train_003.jsonl
1394465400
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot b...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.*; import java.math.BigInteger; import java.util.*; import java.text.*; public class cf401b { static BufferedReader br; static Scanner sc; static PrintWriter out; public static void...
Java
["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0"]
1 second
["0 0", "2 3", "5 9"]
NoteIn the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round. The maximum number of rounds equals ...
Java 7
standard input
[ "implementation", "greedy", "math" ]
fb77c9339250f206e7188b951902a221
The first line contains two integers: x (1 ≀ x ≀ 4000) β€” the round Sereja is taking part in today, and k (0 ≀ k &lt; 4000) β€” the number of rounds he took part in. Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding...
1,200
Print in a single line two integers β€” the minimum and the maximum number of rounds that Sereja could have missed.
standard output
PASSED
af2c3c8f8007e64005d6dd2cc3283896
train_003.jsonl
1394465400
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot b...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Comparator; public class B { static int x,k; static int[] c,d1,d2; static int min(int i) { return (i>>1)+(i&1); } sta...
Java
["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0"]
1 second
["0 0", "2 3", "5 9"]
NoteIn the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round. The maximum number of rounds equals ...
Java 7
standard input
[ "implementation", "greedy", "math" ]
fb77c9339250f206e7188b951902a221
The first line contains two integers: x (1 ≀ x ≀ 4000) β€” the round Sereja is taking part in today, and k (0 ≀ k &lt; 4000) β€” the number of rounds he took part in. Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding...
1,200
Print in a single line two integers β€” the minimum and the maximum number of rounds that Sereja could have missed.
standard output
PASSED
bdb7b608fb75f838f5a8bd7835715ad9
train_003.jsonl
1394465400
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot b...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; public class SerajaAndContests { public static class Pair implements Comparable<Pair>{ public int first,second=0; Pai...
Java
["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0"]
1 second
["0 0", "2 3", "5 9"]
NoteIn the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round. The maximum number of rounds equals ...
Java 7
standard input
[ "implementation", "greedy", "math" ]
fb77c9339250f206e7188b951902a221
The first line contains two integers: x (1 ≀ x ≀ 4000) β€” the round Sereja is taking part in today, and k (0 ≀ k &lt; 4000) β€” the number of rounds he took part in. Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding...
1,200
Print in a single line two integers β€” the minimum and the maximum number of rounds that Sereja could have missed.
standard output
PASSED
9eabb81899396ca441f2b37bea14ca54
train_003.jsonl
1394465400
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot b...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Main { PrintWriter out; BufferedReader input; Main() { try { input = new BufferedReader(new FileReader("input.txt")); out = new PrintWriter(new FileWriter("output.txt"), true); ...
Java
["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0"]
1 second
["0 0", "2 3", "5 9"]
NoteIn the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round. The maximum number of rounds equals ...
Java 7
standard input
[ "implementation", "greedy", "math" ]
fb77c9339250f206e7188b951902a221
The first line contains two integers: x (1 ≀ x ≀ 4000) β€” the round Sereja is taking part in today, and k (0 ≀ k &lt; 4000) β€” the number of rounds he took part in. Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding...
1,200
Print in a single line two integers β€” the minimum and the maximum number of rounds that Sereja could have missed.
standard output
PASSED
81aebea74a75b067cb1a0a33970683fd
train_003.jsonl
1394465400
Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 (for advanced coders) and Div2 (for beginner coders). Two rounds, Div1 and Div2, can go simultaneously, (Div1 round cannot b...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws NumberFormatException,IOException { Stdin in = new Stdin(); PrintWriter out = new PrintW...
Java
["3 2\n2 1\n2 2", "9 3\n1 2 3\n2 8\n1 4 5", "10 0"]
1 second
["0 0", "2 3", "5 9"]
NoteIn the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual Div2 round and the round with identifier 6 will be synchronous with the Div1 round. The maximum number of rounds equals ...
Java 7
standard input
[ "implementation", "greedy", "math" ]
fb77c9339250f206e7188b951902a221
The first line contains two integers: x (1 ≀ x ≀ 4000) β€” the round Sereja is taking part in today, and k (0 ≀ k &lt; 4000) β€” the number of rounds he took part in. Next k lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding...
1,200
Print in a single line two integers β€” the minimum and the maximum number of rounds that Sereja could have missed.
standard output
PASSED
f9f42b8267168ccef2dc75fe4e2cc83e
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int m = scanner.nextInt() , n = scanner.nextInt(); Boolean isThereOne = false; int[][] A = new int[n][m]; int[][] B = new int[n][m]; Bool...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
401ee594ae9a211a93f9da321db0b7fa
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.PrintWriter; import java.util.Ha...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
8a39fb3f098599924bb8b857bccad66f
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.*; import java.lang.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m =sc.nextInt(); int a[][] = new int[n][m]; boolean b[][] = new boolean[n][m]; HashMap<Integer,Integer> h = new HashMap<>(); for(int i=0;i<n;...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
484e6271a0d23e4be2e87a2d8fc53dbf
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class B_orInMatrix { public static void main(String[] args) throws IOException { FastScanner sc = new FastScanner(System.in); PrintWriter pw = new PrintWriter(System.out); int m = sc.nextInt(); int n = sc.next...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
f38f325049cc0c099bf6ce30646c89fd
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); int...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
415c9774cddddb7e6f2c5ae63941582c
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n= sc.nextInt(); int m= sc.nextInt(); int a[][] = new int [n][m]; int b[][] = new int [n][m]; int i,j,ones=0; int f=0; for(i=0;...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
3a3df9d13bf2ada665eda4b8e435aedb
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.*; import java.io.*; public class OR_In_Matrix { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = ne...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
9d91692d4fbe4fb00c0031ba33b6860d
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.io.*; import java.util.*; public class OR_Mtx { public static void main(String[] args)throws IOException { BufferedReader ob=new BufferedReader(new InputStreamReader(System.in)); String s[]=ob.readLine().split(" "); int n=Integer.parseInt(s[0]); int m=Integer.parseInt(s[1]); int b[]...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
ad40cf383c308bd9ab973c12f28c74c6
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; public class zizo { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); P...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
8e74d75c13c6110dda941462528275bd
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
/** * @author egaeus * @mail sebegaeusprogram@gmail.com * @veredict Not sended * @url <https://codeforces.com/problemset/problem/486/B> * @category biginteger * @date 6/06/2020 **/ import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Int...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
c0413772edf1b9ee3c477b8f15a745a3
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.*; public class contest1 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int m = s.nextInt(); int n = s.nextInt(); int arr[][] = new int[m+1][n+1]; int arr1[][] = new int[m+1][n+1]; for(int i=1; i<m+1;i++) { for(int j=1; j<n+1;j++)...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
82b7d42ddca9ed2211decb372a816642
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); int m = sc.nextInt(); int[][] arr = new int[n][m]; for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { arr[i][j] = sc.nextInt(); }...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
5a1723bb71e6a54eafecddaa54c0dba0
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.*; public class hero{ public static void main(String[] args) { Scanner no=new Scanner(System.in); boolean t=true; boolean w=false; int m=no.nextInt(); int n=no.nextInt(); int u=0; int arr[][]=new int[m][n]; int arr1[][]=new int[m][n]; //int arr2[][]=new int[m][n]; for(int i=0;i<m...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
5fee314d99b023565ed5ef7b3ecebaec
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.io.*; import java.util.*; public class OR_Mtx { public static void main(String[] args)throws IOException { BufferedReader ob=new BufferedReader(new InputStreamReader(System.in)); String s[]=ob.readLine().split(" "); int n=Integer.parseInt(s[0]); int m=Integer.parseInt(s[1]); int b[]...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
3dd8e9396cd6784b73fe95fcbff57f6c
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class A{ final int N = 10000; static int cnt[]=new int[27]; static int n; static String multiply(String num1, String num2) { int len1 = num1.length(); int len2 = num2.length(); if (len1 == 0 || len2 == 0) return "0"; // ...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
16d527914123509f8dfa9aec2418a6e5
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.io.*; import java.lang.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { Scanner s = new Scanner(System.in); int m=s.nextInt(); int n=s.nextInt(); int[][] arr = new int[m][n]; int[][] prr = new int[m][n]; ...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
713c8e44188b9700599db26cc19bffa0
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class sa { public static void helper(int [][]arr,int n,int m,int c1,int[][]ans){ if(n==1 && m==1) { System.out.println("YES"); Sys...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
ef3725f3362bfe4cc0e6fc8497383661
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public final class ORInMatrix { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); int b[][]=new int[n][m...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
d24e88ac1f6541cd80c9d9f2da5ccadc
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int a[] = new int[2]; List<Integer> row = new ArrayList<>(); List<Integer> col = new ArrayList<>(); int d[][] = new int[n][m]; ...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
cc23441cadc6a8e2b25ed43d830f8602
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int m,n; m = scanner.nextInt(); n = scanner.nextInt(); int[][] b = new int[m][n]; int[][] a = new int[m][n]; for (int i=0;i<m;i++)...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
a6e469f0f1970e012590320b877af422
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); }...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
b98be57da9a500ba498c3be60d09b363
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.*;import java.io.*;import java.math.*; public class ORinMatrix { public static void process()throws IOException { int m = ni(), n = ni(); int[][] b = new int[m][n]; for(int i = 0; i < m; i++){ b[i] = nai(n); } int f = 0; int[][] c = ne...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
9511c540ce43ec6f4f7be9aee4d1ea5b
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.*; public class helloWorld { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); int[][] A = new int[n][m]; int[][] B = new int[n][m]; String ans = "YES"; for(int i = 0; i < n; i++) for(int j = 0; j < m; j+...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
f153f0712e423a33246fa75e2269a0d8
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
// Author : AMIT KUMAR BARMAN (gearman_0712) import java.io.*; import java.util.*; public class Ormatrix{ static final long modp =1000000007; static long x_ec=1,y_ec=0,d_ec =1; static long maxi=0; static boolean v1 =false ,v2 = false; static InputReader in = new InputReader(System.in); static O...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
d4564061b6a50a82e4759efe1f838b04
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class B { static MyScanner in = new MyScanner(); static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokeniz...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
faa3c132d852efab164112bbaec31db1
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void assign(int i,int j,int a[][],int n,int m){ for(int ii=0;ii<n;ii++){ a[ii][j]=-1; } for(int ii=0;ii<m;ii++){ a[i][ii]=-1; } retu...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
fd20622602a939d57c6765bc424bcca0
train_003.jsonl
1415718000
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical values in the same manner: where is equal to 1 if some ai = 1, otherwis...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static int checkc(int i,int j,int n,int m,int a[][]){ int ans=0; for(int jj=0;jj<m;jj++){ ans=ans | a[i][jj]; } for(int jj=0;jj<n;jj++){ ans=...
Java
["2 2\n1 0\n0 0", "2 3\n1 1 1\n1 1 1", "2 3\n0 1 0\n1 1 1"]
1 second
["NO", "YES\n1 1 1\n1 1 1", "YES\n0 0 0\n0 1 0"]
null
Java 11
standard input
[ "implementation", "hashing", "greedy" ]
bacd613dc8a91cee8bef87b787e878ca
The first line contains two integer m and n (1 ≀ m, n ≀ 100), number of rows and number of columns of matrices respectively. The next m lines each contain n integers separated by spaces describing rows of matrix B (each element of B is either 0 or 1).
1,300
In the first line, print "NO" if Nam has made a mistake when calculating B, otherwise print "YES". If the first line is "YES", then also print m rows consisting of n integers representing matrix A that can produce given matrix B. If there are several solutions print any one.
standard output
PASSED
6cf17080a2004bf92d250245de405974
train_003.jsonl
1520696100
There is a number x initially written on a blackboard. You repeat the following action a fixed amount of times: take the number x currently written on a blackboard and erase it select an integer uniformly at random from the range [0, x] inclusive, and write it on the blackboard Determine the distribution of final nu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.Deque; import java.util.function.Supplier; import java.io.OutputStreamWriter; import java.math.BigInteger; import java.io.OutputStream; import java.io.PrintStream; import java.util.Collection; ...
Java
["2 1\n0 0 1", "2 2\n0 0 1", "9 350\n3 31 314 3141 31415 314159 3141592 31415926 314159265 649178508"]
2 seconds
["332748118 332748118 332748118", "942786334 610038216 443664157", "822986014 12998613 84959018 728107923 939229297 935516344 27254497 413831286 583600448 442738326"]
NoteIn the first case, we start with number 2. After one step, it will be 0, 1 or 2 with probability 1/3 each.In the second case, the number will remain 2 with probability 1/9. With probability 1/9 it stays 2 in the first round and changes to 1 in the next, and with probability 1/6 changes to 1 in the first round and s...
Java 8
standard input
[ "fft", "math", "matrices" ]
0642a91cb581e0c39ed37db4d3dbe9b2
The first line contains two integers, N (1 ≀ N ≀ 105)Β β€” the maximum number written on the blackboardΒ β€” and M (0 ≀ M ≀ 1018)Β β€” the number of steps to perform. The second line contains N + 1 integers P0, P1, ..., PN (0 ≀ Pi &lt; 998244353), where Pi describes the probability that the starting number is i. We can express ...
3,100
Output a single line of N + 1 integers, where Ri is the probability that the final number after M steps is i. It can be proven that the probability may always be expressed as an irreducible fraction P / Q. You are asked to output .
standard output
PASSED
d0743c81985225c285d6149d28585241
train_003.jsonl
1520696100
There is a number x initially written on a blackboard. You repeat the following action a fixed amount of times: take the number x currently written on a blackboard and erase it select an integer uniformly at random from the range [0, x] inclusive, and write it on the blackboard Determine the distribution of final nu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.Deque; import java.util.function.Supplier; import java.io.OutputStreamWriter; import java.math.BigInteger; import java.io.OutputStream; import java.io.PrintStream; import java.util.Collection; ...
Java
["2 1\n0 0 1", "2 2\n0 0 1", "9 350\n3 31 314 3141 31415 314159 3141592 31415926 314159265 649178508"]
2 seconds
["332748118 332748118 332748118", "942786334 610038216 443664157", "822986014 12998613 84959018 728107923 939229297 935516344 27254497 413831286 583600448 442738326"]
NoteIn the first case, we start with number 2. After one step, it will be 0, 1 or 2 with probability 1/3 each.In the second case, the number will remain 2 with probability 1/9. With probability 1/9 it stays 2 in the first round and changes to 1 in the next, and with probability 1/6 changes to 1 in the first round and s...
Java 8
standard input
[ "fft", "math", "matrices" ]
0642a91cb581e0c39ed37db4d3dbe9b2
The first line contains two integers, N (1 ≀ N ≀ 105)Β β€” the maximum number written on the blackboardΒ β€” and M (0 ≀ M ≀ 1018)Β β€” the number of steps to perform. The second line contains N + 1 integers P0, P1, ..., PN (0 ≀ Pi &lt; 998244353), where Pi describes the probability that the starting number is i. We can express ...
3,100
Output a single line of N + 1 integers, where Ri is the probability that the final number after M steps is i. It can be proven that the probability may always be expressed as an irreducible fraction P / Q. You are asked to output .
standard output
PASSED
cbd97c0e865495fabf2412837737e9b5
train_003.jsonl
1548254100
You are given two segments $$$[l_1; r_1]$$$ and $$$[l_2; r_2]$$$ on the $$$x$$$-axis. It is guaranteed that $$$l_1 &lt; r_1$$$ and $$$l_2 &lt; r_2$$$. Segments may intersect, overlap or even coincide with each other. The example of two segments on the $$$x$$$-axis. Your problem is to find two integers $$$a$$$ and $$...
256 megabytes
import java.util.Scanner; public class two_distinct_points { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t>0) { int l1 = sc.nextInt(); int r1 = sc.nextInt(); int l2 = sc.nextInt(); ...
Java
["5\n1 2 1 2\n2 6 3 4\n2 4 1 3\n1 2 1 3\n1 4 5 8"]
1 second
["2 1\n3 4\n3 2\n1 2\n3 7"]
null
Java 11
standard input
[ "implementation" ]
cdafe800094113515e1de1acb60c4bb5
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) β€” the number of queries. Each of the next $$$q$$$ lines contains four integers $$$l_{1_i}, r_{1_i}, l_{2_i}$$$ and $$$r_{2_i}$$$ ($$$1 \le l_{1_i}, r_{1_i}, l_{2_i}, r_{2_i} \le 10^9, l_{1_i} &lt; r_{1_i}, l_{2_i} &lt; r_{2_i}$$$) β€” the en...
800
Print $$$2q$$$ integers. For the $$$i$$$-th query print two integers $$$a_i$$$ and $$$b_i$$$ β€” such numbers that $$$l_{1_i} \le a_i \le r_{1_i}$$$, $$$l_{2_i} \le b_i \le r_{2_i}$$$ and $$$a_i \ne b_i$$$. Queries are numbered in order of the input. It is guaranteed that the answer exists. If there are multiple answers,...
standard output
PASSED
41a1dd744cdb71514a99705c2fe1ed19
train_003.jsonl
1548254100
You are given two segments $$$[l_1; r_1]$$$ and $$$[l_2; r_2]$$$ on the $$$x$$$-axis. It is guaranteed that $$$l_1 &lt; r_1$$$ and $$$l_2 &lt; r_2$$$. Segments may intersect, overlap or even coincide with each other. The example of two segments on the $$$x$$$-axis. Your problem is to find two integers $$$a$$$ and $$...
256 megabytes
import java.io.*; import java.util.*; public class Twodistinctpoints { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int numofqueries = Intege...
Java
["5\n1 2 1 2\n2 6 3 4\n2 4 1 3\n1 2 1 3\n1 4 5 8"]
1 second
["2 1\n3 4\n3 2\n1 2\n3 7"]
null
Java 11
standard input
[ "implementation" ]
cdafe800094113515e1de1acb60c4bb5
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) β€” the number of queries. Each of the next $$$q$$$ lines contains four integers $$$l_{1_i}, r_{1_i}, l_{2_i}$$$ and $$$r_{2_i}$$$ ($$$1 \le l_{1_i}, r_{1_i}, l_{2_i}, r_{2_i} \le 10^9, l_{1_i} &lt; r_{1_i}, l_{2_i} &lt; r_{2_i}$$$) β€” the en...
800
Print $$$2q$$$ integers. For the $$$i$$$-th query print two integers $$$a_i$$$ and $$$b_i$$$ β€” such numbers that $$$l_{1_i} \le a_i \le r_{1_i}$$$, $$$l_{2_i} \le b_i \le r_{2_i}$$$ and $$$a_i \ne b_i$$$. Queries are numbered in order of the input. It is guaranteed that the answer exists. If there are multiple answers,...
standard output
PASSED
58057c0dd05588193684a969e3ea77f5
train_003.jsonl
1548254100
You are given two segments $$$[l_1; r_1]$$$ and $$$[l_2; r_2]$$$ on the $$$x$$$-axis. It is guaranteed that $$$l_1 &lt; r_1$$$ and $$$l_2 &lt; r_2$$$. Segments may intersect, overlap or even coincide with each other. The example of two segments on the $$$x$$$-axis. Your problem is to find two integers $$$a$$$ and $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { ...
Java
["5\n1 2 1 2\n2 6 3 4\n2 4 1 3\n1 2 1 3\n1 4 5 8"]
1 second
["2 1\n3 4\n3 2\n1 2\n3 7"]
null
Java 11
standard input
[ "implementation" ]
cdafe800094113515e1de1acb60c4bb5
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) β€” the number of queries. Each of the next $$$q$$$ lines contains four integers $$$l_{1_i}, r_{1_i}, l_{2_i}$$$ and $$$r_{2_i}$$$ ($$$1 \le l_{1_i}, r_{1_i}, l_{2_i}, r_{2_i} \le 10^9, l_{1_i} &lt; r_{1_i}, l_{2_i} &lt; r_{2_i}$$$) β€” the en...
800
Print $$$2q$$$ integers. For the $$$i$$$-th query print two integers $$$a_i$$$ and $$$b_i$$$ β€” such numbers that $$$l_{1_i} \le a_i \le r_{1_i}$$$, $$$l_{2_i} \le b_i \le r_{2_i}$$$ and $$$a_i \ne b_i$$$. Queries are numbered in order of the input. It is guaranteed that the answer exists. If there are multiple answers,...
standard output
PASSED
af9e8bdbe84dbdc5c36fddf8a95cb054
train_003.jsonl
1548254100
You are given two segments $$$[l_1; r_1]$$$ and $$$[l_2; r_2]$$$ on the $$$x$$$-axis. It is guaranteed that $$$l_1 &lt; r_1$$$ and $$$l_2 &lt; r_2$$$. Segments may intersect, overlap or even coincide with each other. The example of two segments on the $$$x$$$-axis. Your problem is to find two integers $$$a$$$ and $$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int q=s.nextInt(); while(q-...
Java
["5\n1 2 1 2\n2 6 3 4\n2 4 1 3\n1 2 1 3\n1 4 5 8"]
1 second
["2 1\n3 4\n3 2\n1 2\n3 7"]
null
Java 11
standard input
[ "implementation" ]
cdafe800094113515e1de1acb60c4bb5
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) β€” the number of queries. Each of the next $$$q$$$ lines contains four integers $$$l_{1_i}, r_{1_i}, l_{2_i}$$$ and $$$r_{2_i}$$$ ($$$1 \le l_{1_i}, r_{1_i}, l_{2_i}, r_{2_i} \le 10^9, l_{1_i} &lt; r_{1_i}, l_{2_i} &lt; r_{2_i}$$$) β€” the en...
800
Print $$$2q$$$ integers. For the $$$i$$$-th query print two integers $$$a_i$$$ and $$$b_i$$$ β€” such numbers that $$$l_{1_i} \le a_i \le r_{1_i}$$$, $$$l_{2_i} \le b_i \le r_{2_i}$$$ and $$$a_i \ne b_i$$$. Queries are numbered in order of the input. It is guaranteed that the answer exists. If there are multiple answers,...
standard output
PASSED
a37f6779afc33704cfa3b6020dcce857
train_003.jsonl
1548254100
You are given two segments $$$[l_1; r_1]$$$ and $$$[l_2; r_2]$$$ on the $$$x$$$-axis. It is guaranteed that $$$l_1 &lt; r_1$$$ and $$$l_2 &lt; r_2$$$. Segments may intersect, overlap or even coincide with each other. The example of two segments on the $$$x$$$-axis. Your problem is to find two integers $$$a$$$ and $$...
256 megabytes
// package cp; import java.io.*; import java.math.*; import java.util.*; public class Cf_three { long gcd(long a,long b) {if(b==0)return a;else return gcd(b,a%b);} void swap(long a,long b) {long temp=a;a=b;b=temp;} public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(Syste...
Java
["5\n1 2 1 2\n2 6 3 4\n2 4 1 3\n1 2 1 3\n1 4 5 8"]
1 second
["2 1\n3 4\n3 2\n1 2\n3 7"]
null
Java 11
standard input
[ "implementation" ]
cdafe800094113515e1de1acb60c4bb5
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) β€” the number of queries. Each of the next $$$q$$$ lines contains four integers $$$l_{1_i}, r_{1_i}, l_{2_i}$$$ and $$$r_{2_i}$$$ ($$$1 \le l_{1_i}, r_{1_i}, l_{2_i}, r_{2_i} \le 10^9, l_{1_i} &lt; r_{1_i}, l_{2_i} &lt; r_{2_i}$$$) β€” the en...
800
Print $$$2q$$$ integers. For the $$$i$$$-th query print two integers $$$a_i$$$ and $$$b_i$$$ β€” such numbers that $$$l_{1_i} \le a_i \le r_{1_i}$$$, $$$l_{2_i} \le b_i \le r_{2_i}$$$ and $$$a_i \ne b_i$$$. Queries are numbered in order of the input. It is guaranteed that the answer exists. If there are multiple answers,...
standard output
PASSED
268b4ce5b72259c8e8b7c6dedf364cf4
train_003.jsonl
1548254100
You are given two segments $$$[l_1; r_1]$$$ and $$$[l_2; r_2]$$$ on the $$$x$$$-axis. It is guaranteed that $$$l_1 &lt; r_1$$$ and $$$l_2 &lt; r_2$$$. Segments may intersect, overlap or even coincide with each other. The example of two segments on the $$$x$$$-axis. Your problem is to find two integers $$$a$$$ and $$...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class CodeChef { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); int testcases = scan.nextInt(); for(int m=0; m<testcases; m++) { int l1 = scan.ne...
Java
["5\n1 2 1 2\n2 6 3 4\n2 4 1 3\n1 2 1 3\n1 4 5 8"]
1 second
["2 1\n3 4\n3 2\n1 2\n3 7"]
null
Java 11
standard input
[ "implementation" ]
cdafe800094113515e1de1acb60c4bb5
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 500$$$) β€” the number of queries. Each of the next $$$q$$$ lines contains four integers $$$l_{1_i}, r_{1_i}, l_{2_i}$$$ and $$$r_{2_i}$$$ ($$$1 \le l_{1_i}, r_{1_i}, l_{2_i}, r_{2_i} \le 10^9, l_{1_i} &lt; r_{1_i}, l_{2_i} &lt; r_{2_i}$$$) β€” the en...
800
Print $$$2q$$$ integers. For the $$$i$$$-th query print two integers $$$a_i$$$ and $$$b_i$$$ β€” such numbers that $$$l_{1_i} \le a_i \le r_{1_i}$$$, $$$l_{2_i} \le b_i \le r_{2_i}$$$ and $$$a_i \ne b_i$$$. Queries are numbered in order of the input. It is guaranteed that the answer exists. If there are multiple answers,...
standard output
PASSED
9c4bcd3d56004f4691f8603f64b55828
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.*; public class cf216b { static int n, numColors = 0; static ArrayList<Integer>[] g; static int[] color; public static void main(String[] args) { Scanner in = new Scanner(System.in); n = in.nextInt(); int m = in.nextInt(); g = new ArrayList[n]; color = new int[n]; Arrays.fill(color, -1...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
2dc9e53822f52433a26f8af341a8b36c
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.*; import java.lang.reflect.Array; import java.math.*; import java.io.*; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; public class Main { //ArrayList<Integer> lis = new ArrayList<Integer>(); //ArrayList<String> lis = new ArrayList<Stri...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
bcac6058c491b07416f04144dddc6a7a
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.LinkedList; import java.util.Map.Entry; import java.util.Queue; import java.util.StringTokenizer; public class FormingTeams { void run() throws Exception { BufferedReader bfd...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
d93549fe61223a025bcc80cacb8973fb
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class B { int n, m, res; boolean[][] a; int[] u; void f(int k){ boolean A = true, B = true; for(int i=0;i<n;i++){ if(a[k][i]&&0==u[i])A = false; if(a[k][i]&&1==u[i])B = false; } if(!A...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
a7868d9de2c2f30cd73a3744f98d100c
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.awt.*; import java.awt.geom.*; import java.io.*; import java.math.*; import java.text.*; import java.util.*; /* br = new BufferedReader(new FileReader("input.txt")); pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); br = new BufferedReader(new InputStreamReader(System.in)); pw = new P...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
3208a3058fcbf5fa96c784bb62deb702
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.*; public class Main{ int n,m; boolean g[][]; int []col; public void run(){ Scanner in = new Scanner(System.in); n = in.nextInt(); m = in.nextInt(); g = new boolean[n][n]; for(int i=0;i<m;i++){ int a = in.nextInt()-1; int b = in.nextInt()-1; g[a][b] = g[b][a] = true; } ...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
6b5c91d033f872946632cda138cf9d50
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.*; public class Main{ int n,m; boolean g[][]; boolean []used; int []col, comp; public void run(){ Scanner in = new Scanner(System.in); n = in.nextInt(); m = in.nextInt(); g = new boolean[n][n]; for(int i=0;i<m;i++){ int a = in.nextInt()-1; int b = in.nextInt()-1; g[a][b] = ...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
cb93969ab21d5016158954ccbd8a88b1
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class fasi { /** * @param args * @throws IOException */ static int color[]; static boolean v[]; static int ft; static int st; pu...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
745ddaec5fa41702473503abc1d90207
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.*; public class B { BufferedReader in; PrintStream out; StringTokenizer tok; public B() throws NumberFormatException, IOException { in = new Buffe...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
bac1b02f6ed623a32c664162ddaf2131
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.Scanner; public class B { static boolean[]used; static int[][]a; static int cnt = 0, n; static boolean circle = false; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); int m = sc.nextInt(); a = new int...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
8faf6604c03038ab32e827fc39d6bfe6
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Teams { static int[] teams; static boolean[] seen; static ArrayList<Integer>[] map; public static void main(String[] args) { Scanner br=new Scanner(System.in); int n=br.nextInt(); map=new ArrayList[n]; for(int i=0;i<n;i++) map[i]=new A...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
1a7eca4e6cdb393c5d0cff2bfd087bbb
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Erik ...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
c2ffd710d5f137920e84696ae1c66490
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class B extends B_Problem { int n, m, kick; ArrayList<Integer>[] g; int[] col; void solve() { n = nextInt(); m = nextInt(); g = new ArrayList[n]; for (int i = 0; i < n; i++) g[i] = new ArrayList<Integer>(0); for (int i = 0;...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
dfd3e762d7a1fc5ebffda58889c9c0b3
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.ArrayList; import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner r = new Scanner(System.in); int N = r.nextInt(); int M = r.nextInt(); g = new ArrayList[N]; for(int i = 0; ...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
b779c25e6450bce9b5389608b3032216
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.LinkedList; import java.util.Scanner; public class ProblemB { private static ArrayList<Integer>[] students; private static boolean[] labels; private static int allOddCycles = 0; private static void dfs(i...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
c33ddd3e5351dfffb7f87cb0abc57a00
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.Scanner; public class CF216B { static int n; static int m; static int [][]G; static int []visited; static int c; static int d; static int start; public static void DFS(int depth, int id) { if (visited[id]!=-1) { return; } visited[id] = c; for (int i=0; i!=n; i++) { if(G[id][i]...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
91fabe871a4f889ef2135a22367dd74d
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.io.*; import java.util.*; import java.awt.*; import static java.lang.Math.*; public class teams { static void dbg(Object...os) { System.err.println(Arrays.deepToString(os)); } static BufferedReader input; static StringTokenizer _stk; static String readln() throws IOException { String l = input.rea...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
f4856570ccfe860704b70a1c01b689a5
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.List; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.ArrayList; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.math.BigInteger; import java.util.Collecti...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
ac2983089f314a7f97b4811200c5794d
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.ArrayList; import java.util.HashSet; import java.util.Scanner; public class Main { private static ArrayList <ArrayList <Integer>> graph = new ArrayList <ArrayList <Integer>>(); private static HashSet <Integer> visited = new HashSet <Integer>(); private static boolean flag; private st...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
94e7b07b2ba1e92bc46a8dc637f59de4
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; /** * * @author JuanCarlos */ public class Main { /** * @param args the command line arguments */ static int ady [][]=new int[101][101]; static int g[]=new int[101]; ...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
a16d7cc7403b5f6e9ec69684ea15aecd
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.*; import java.io.*; public class hercules { static boolean used[]; static ArrayList<Integer>temp[]; static int colour[]; public static void dfs(int a,int val){ used[a]=true; colour[a]=val; for(int x:temp[a]){ if(!used[x]) dfs(x,val); } } public static void main(String [] args)throws...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
abbbdfdd50e994341841b505c6633ca8
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.Scanner; public class TeamBuilding { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // int n = 50, m = 48; // int[] s = {33, 1, 43, 1, 42,31, 14, 34, 38, 46, 49, 8, 27, 26, 15, 27, 9, 18, 35, 32, 23, 36, 16, 39, 40, 11, 21, 10, 30, 20, 24, 43,...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
70046823158e16867dacf0ba8821bf80
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class B { Scanner sc = new Scanner(System.in); boolean [][] g; boolean [] used; int [] deg; void doIt() { int n = sc.nextInt(); int m = sc.nextInt(); g = new boolean[n][n]; used = new boolean[n]; deg = new int[n...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
d6ec2d908d701f47997e87110a9c0da8
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.*; import java.io.*; public class a { public static void main(String[] args) throws IOException { //Scanner input = new Scanner(new File("input.txt")); //PrintWriter out = new PrintWriter(new File("output.txt")); input.init(System.in); PrintWriter out = new PrintWriter(System.out); int...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
2c51133c11be087389f6ba5dbd134e35
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.Scanner; public class BB { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int b[] = new int [n+2]; int c[]...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
5c0013a8841bb6fd5dc0a3698ccf82ac
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class B { public static void main(String[] args) throws IOException { BufferedReader buf = new BufferedReader( new InputStreamReader(System.in)); String[] in = buf.readLine().split(...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
97bb2ed611333c468bc888f065d664ae
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.Scanner; public class Prob216B { public static void main(String[] Args) { Scanner in = new Scanner(System.in); int students = in.nextInt(); int pairs = in.nextInt(); int[][] arch = new int[students][3]; for (int i = 0; i < students; i++) arch[i] = new int[] { 0, -1, -1 }; for (int i...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
522145e6cbb25c4150df6f685526f34c
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.util.Scanner; public class Main { static int[][] enemy; static int[] enemies; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); enemy = new int[n][2]; enemies = new int[n]; int m = sc.nextInt(); ...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
17b64a84c640069eeb874509833152d0
train_003.jsonl
1344958200
One day n students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student A is an archenemy to student B, then student B is...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; public class B216 { static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter out = new PrintWriter(System.out); ...
Java
["5 4\n1 2\n2 4\n5 3\n1 4", "6 2\n1 4\n3 4", "6 6\n1 2\n2 3\n3 1\n4 5\n5 6\n6 4"]
2 seconds
["1", "0", "2"]
null
Java 6
standard input
[ "implementation", "dfs and similar" ]
a0e55bfbdeb3dc550e1f86b9fa7cb06d
The first line contains two integers n and m (2 ≀ n ≀ 100, 1 ≀ m ≀ 100) β€” the number of students and the number of pairs of archenemies correspondingly. Next m lines describe enmity between students. Each enmity is described as two numbers ai and bi (1 ≀ ai, bi ≀ n, ai ≠ bi) β€” the indexes of the students who are enemie...
1,700
Print a single integer β€” the minimum number of students you will have to send to the bench in order to start the game.
standard output
PASSED
e70be21dbeb6ca104e3c67cc853f3afe
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n = cin.nextInt( ); double temp, pi = 3.141592653589793; double[] array = new double[n]; for( int i=0; i<n; i++ ) array[i] = Double...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
8e5a2f4ac88116c62cd0efdd778ba1c6
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n = cin.nextInt( ); double temp, pi = 3.141592653589793; double[] array = new double[n]; for( int i=0; i<n; i++ ) array[i] = Double...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
64b4df4d39b1a57c2ad31fbe1c4751a8
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class ProblemB { public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = new PrintWriter...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
e2d4fb631d2180a8559af88e6881effe
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.util.*; public class Trace { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] rs = new int[n]; for (int i = 0; i < n; i++) rs[i] = sc.nextInt(); sc.close(); Arrays.sort(rs); double res = 0, pi = Math.PI; int sign = 1; for ...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
f8d398280039ccafe81916a875f7d823
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.io.*; import java.util.*; public class Intueor { public static void main(String[] args) throws Exception { new Main().run(); } } class Cmp implements Comparator<Integer> { public int compare(Integer x, Integer y) { if(x > y) return -1; return 1; } } cl...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
e56181240f67a937721c8439402f34ab
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.io.*; import java.util.*; import java.util.Map.Entry; public class Main { static BufferedReader br; static PrintWriter out; static StringTokenizer st; static void solve() throws Exception { int n = nextInt(); Integer[] r = new Integer[n + 1]; for(int i = 0; i < ...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
711fc8d2d86814622d0938e5ad66b03b
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Trace { public static void main (String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System....
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
1bde1bfbc0aab235cac309bf369c41bf
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class practice { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); double pi = Math.PI; int [] c = new int[n]; for(int i = 0; i<n; i++) c[i] = sc.nextInt(); Arrays.sort(c); double redArea =...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
bf50ad48547718d1421494f96ebb64f2
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.io.*; import java.util.*; public class Trace { public static void main(String[]args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int [] radii = new int[n]; StringTokenizer st = ne...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
9ef29b87335c6256e8f7eb7c4e305e2f
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
/* /** * * @author Hendry */ import java.util.*; public class Main { static Scanner scan; public static void main(String[] args) { scan = new Scanner(System.in); int n = scan.nextInt(); double sum = 0.0; int []circles = new int[n]; ...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
c3107deef3144d9c33929a5de1f22eb8
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main1 { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n= scan.nextInt(); float cad[]= new float[n]; for (int i = 0; i < n; i++) { cad[i]=scan.nextFloat(); } Arrays.sort(cad); double total=0; boole...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
15e42daa14e22d03e27356665abb4054
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main1 { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int n= scan.nextInt(); float cad[]= new float[n]; for (int i = 0; i < n; i++) { cad[i]=scan.nextFloat(); } Arrays.sort(cad); double total=0; bool...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
11bc44426b0d7c7d42de3fc95b839da4
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.util.Arrays; public class Case { static class InputReader { final private int B_SIZE = 1 << 16; private DataInputStream d; private byte[] buffer; private int pointer, bytes; public InputReader() {...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
eba6bbf27ae3bd0e844e82058c8fcabc
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.Queue; import java.util.StringTokenizer;...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output
PASSED
e9f1201c2ecd53cbcdbc19b9d7a89c1a
train_003.jsonl
1330536600
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
256 megabytes
import java.util.*; import java.io.*; public class Main { public void solve() throws IOException { int n=nextInt(); int []rad = new int[n]; for (int i=0; i<n; i++) { rad[i]=nextInt(); } Arrays.sort(rad); boolean include=false; if (n%2==1) inc...
Java
["1\n1", "3\n1 4 2"]
2 seconds
["3.1415926536", "40.8407044967"]
NoteIn the first sample the picture is just one circle of radius 1. Inner part of the circle is painted red. The area of the red part equals π × 12 = π.In the second sample there are three circles of radii 1, 4 and 2. Outside part of the second circle is painted blue. Part between the second and the third circles is pa...
Java 7
standard input
[ "sortings", "geometry" ]
48b9c68380d3bd64bbc69d921a098641
The first line contains the single integer n (1 ≀ n ≀ 100). The second line contains n space-separated integers ri (1 ≀ ri ≀ 1000) β€” the circles' radii. It is guaranteed that all circles are different.
1,000
Print the single real number β€” total area of the part of the wall that is painted red. The answer is accepted if absolute or relative error doesn't exceed 10 - 4.
standard output