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
309fc6d092383fc96c7e8b1fc970a8f4
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.Scanner; public class codeforces { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[8]; char c='0'; int ans=0; for (int k=0;k<4;k++) { for (int i = 0; i < n; i++) { ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
b80a6fa9f82250e65a95d3ac16da07fd
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
//package temp; import java.util.*; public class Main { static final int maxn = 110; static final int dead = 0x7f7f7f7f; public static void main(String[] args) { Scanner in = new Scanner(System.in); int[] cout=new int[5]; int n=in.nextInt(); String temp; for(int i=1;i<=4;i++){ for(int j=1;j<=n;j++) {...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
56044acb40a8b2146737af6613227dae
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class templ { public static void main(String[] args) throws FileNotFoundException { try { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); int n=in.nextInt(...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
3f1ead9a7436620d51066c9b5bf8a516
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchException; import java.util.StringTokenizer; /* * * daiic...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
d8cd1532f6825bb5ac93fb573093a480
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
//package com.company; import java.util.Scanner; import static java.lang.Math.min; public class Main { public static void main(String[] args) { int n; Scanner sc = new Scanner(System.in); n = sc.nextInt(); String s[][] = new String[4][n]; for (int i = 0; i < 4; i++) { ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
d2f36f307a4fc5782a97c04e5c1ad139
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.util.Arrays; import java.util.StringToken...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
790fe0a9c5dc6304bb0c38af403c9c65
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class C { /********************************************************************************************** * DEBUG * *********************************************...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
cf21b3d0e44c9db6eeb422ff85274049
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args){ Solution solution = new Solution(); solution.solve(); } private void solve() { Scanner in = new Scanner(System.in); int n = in.nextInt(); String[][] chess = new String[4][n]; int[][] r = new int[4][2]; int tot...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
64832f88cfb69822db7838e743893543
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.InputMismatchException; public class A3 { static int n; static int compare(char[][] x, char[][] y) { int count = 0; for (int i = 0; i < n; i++) { for (int j...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
f6411430f4cb411b05ab19ca767e7727
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.*; import java.util.*; public class Question { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); boolean[][] arrOne = new boolean[n][n]; boolean[][] arrTwo = new boolean[n][n...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
29c8c1bde7bda6bde6128f44522dacfc
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.stream.IntStream; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.s...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
06a9b1db7d6cb092ccdc0a5085d3152e
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.*; import java.io.*; public class C961 { static int n; static char[][][] board; public static void main(String[] args) throws Exception { st = new StringTokenizer(in.readLine()); n = i(); board = new char[4][n][n]; for (int i = 0; i < 4; i++) { for (int j = 0; j < n; j++) { board[i...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
1dd57c775c237f454770a51498e2f805
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.*; import java.util.*; public class Solution{ InputStream is; PrintWriter out; String INPUT = ""; Scanner in=new Scanner(System.in); int n; public void solve(){ n = ni(); char[][] m1 = nm(n, n); char[][] m2 = nm(n, n); char[][] m3 = nm(n, n); char[][] m4 = nm(n, n); char[] p = {'1',...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
ebe26f812a98b46d91c3c1136de39122
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
0b47fdb155646697df50e8a95185312d
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.*; import java.util.*; public class ec { static InputStream is; public static void main(String[] args) throws IOException { is = System.in; int n = ni(); int[] z = new int[4]; int[] o = new int[4]; for(int i =0; i< 4; i++){ for(int j = 0; j < n; j++){ char[] line = ns().toCha...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
1565a24487efcd6fbc2c8cfb60432e47
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class code5 { InputStream is; PrintWriter out; static long mod=pow(10,9)+7; int dx[]= {0,0,1,-1},dy[]={+1,-1,0,0}; void solve() { int n=ni(); char arr[][][]=new char[4][n][n]; for(int i=0;i<4;i++) { for(int j=0;j<n;j++) { String s=...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
f1fbc01b70fd7db6fa22728c07ae6114
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Solution { private static int minColoring(int n, int[][][] boards) { int[][] defects = new int[2][4]; for (int board = 0; board < 4; board++) for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
ee9b002fbbe5cbef768b07c8a037d2ac
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[][] dosk1 = new int[N][N]; int[][] dosk2 = new int[N][N]; int[][] dosk3 = new int[N][N]; int[][] dosk4 = new int[N][N]; ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
e7fbbbc1930d31149e66a588c6ae6150
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[][] dosk1 = new int[N][N]; int[][] dosk2 = new int[N][N]; int[][] dosk3 = new int[N][N]; int[][] dosk4 = new int[N][N]; ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
4bb163485280277e44a8eeb6d8f8db97
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import java.util.PrimitiveIterator; import java.util.Spliterator; import java.util.Spliterators; import java.util.function.Supplier; import java.util.stream.IntStream; import java.util.stream.LongStrea...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
5299a55968a570299d35fd27521a5ad7
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; /** * todo * * @author hemenghai * @date 2019/1/23 18:50 */ public class Main { private static int cur, pos, sum, len; private static int max, min, ans, res; private static int...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
25a371c0eaee611615a09c0df4c39c70
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class C { static int convert (char [][]a,int x) { int n=a.length; int ans=0; for(int i=0;i<n;i++) f...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
dd2a2754dbc44938beebbd4dacaf6f53
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
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 class Obj implements Comparable<Obj>{ public int start; public int end; ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
2d2010af0de0144cdc6b712642058a8a
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import java.util.HashSet; import java.util.Arrays; import java.util.Scanner; import java.util.Set; import java.util.ArrayList; import java.util.Collections; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
5f7b673b7842a4f9d6db163fd13d9ded
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; public class Main { public static void main(String[] args) throws IOException{ // write your code here ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
70f70778b70859e69d94c13326bbfa35
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class CF961C { class Quadrant { char[][] grid; public Quadrant(char[][] gg) {grid = gg;} int length() {return grid.length;} char[] row(int i) {return grid[i];}; } class ChessBoard { int n; Quadrant[] q; char[][] grid; public ChessBo...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
8647ed2802bd9401f9997ba16b656234
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class ChessBoard { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.nextLine()); List<List<Integer>> boards = new ArrayList<>(); for (int i = ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
63ee4c3ef98881d5859435a1623843cd
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.Writer; import java.io.OutputStream...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
c4a0bf13b3f6b70412367ae70e8ef62c
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class cf961c { static int[] item,perm; static boolean[] used; static char[][][] map; static char[][] aa; static char[][] bb; static int min; static int size; public static void main(String[] args) { Scanner sc = new Sca...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
680528e6ac05a1b9e40f16e92dba280b
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.List; import java.util.ArrayList; i...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
91771be05e0b5051717f1f0afd131d33
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.*; import java.io.*; public class P961C { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); Board[] boards = new Board[4]; for(int i = 0; i < 4; ++i) ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
8395b464b7d091900ea6b39a9590cba6
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.*; public class Main { public int getCount(boolean[][] board){ boolean rowElem = true; int res = 0; for(int i = 0; i < board.length; i++){ boolean colElem = rowElem = rowElem ^ true; for(int j = 0; j < board.length; j++){ if(board[i]...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
94759d0fb940ec39ee6ef5a9a1c3cc7e
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.*; import java.util.*; public class Source { static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner() { br = new BufferedReader(new InputStreamReader(System.in)); } public FastScanner(String s) { try { ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
ffdcb5b5c543f5193abf36e6ecab5d7b
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.*; import org.omg.PortableInterceptor.INACTIVE; import java.awt.List; import java.io.*; import java.lang.*; public class code2 { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(System.out); //Code starts.. ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
64bbdf7a58f650e4ecd37c9397c6a1c8
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.math.*; import java.util.Collections; public class codeforce{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] nb0 = new int[4]; int[] nb1 = new int[4]; Stri...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
982d7e7732747a4d4800ae4578681f0d
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.Scanner; import java.util.Arrays; import java.util.Collections; import java.util.ArrayList; public class Main { public static void main (String[] args) throws IOException { Scanner sc = new Scanner(System...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
994f1fe6fa1d22292baec0e79f815f32
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
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.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
8afa87656a6d6fb877bfa5282264bab4
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import static java.lang.Math.min; import static java.lang.Math.max; public class Main { static class Task { int n, ans = Integer.MAX_VALUE; String s1 = "", s2 = ""; String[] a1; void permutation(int pos, int[] a) { ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
ea394a7e6d3245b9667f734b607264a3
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
//package main; import java.io.*; import java.util.*; import java.math.*; public final class Main { BufferedReader br; StringTokenizer stk; public static void main(String[] args) throws Exception { new Main().run(); } { stk = null; br = new BufferedReader(new Inpu...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
ccf5a9a6594bdca49120b5582f734aaa
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int pt=0; static int[][] p; public static void main(String args[]) { Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(Sy...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
58f9a3cfa782ebb74ca3bbc4bd38e74d
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args) { FastScanner fs=new FastScanner(); int n=fs.nextInt(); int[] counts=new int[4]; for (int b=0; b<4; b...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
854736ea4cff2e2e11a772c1e4e2e25c
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
af5f3bc4e99f4a1e018e8f9f37017083
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
/** * Date: 13 Apr, 2018 * Link: * * @author Prasad-Chaudhari * @email prasadc8897@gmail.com */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class newProgram { public static void main(String[] args) throws IOException { // TODO code applicati...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
13a52126333ec0e18250f593998ebec6
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class c { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); ArrayList<StringBuffer> a = new ArrayList<StringBuffer>(); ArrayList<StringBuffer> b = new ArrayList<StringB...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
fac5a8cc0db01d6ab35daa2710570b4a
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws java.lang.Exception { fast s = new fast(); PrintWriter out=new PrintWriter(System.out); StringBuilder final_ans = new StringBuilder(); int n=s.nextInt(); int [][] a...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
507afa709dfa5ce3ff57e38fb236b247
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Scanner; import java.util.StringTokenizer; public class P961C { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[][][] color = new int[4][n][n...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
6384bae386b7298008ad363de90ff431
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
// CodeForces Round #667 B competition import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.sql.Array; import java.util.Arrays; public class Chessboard { class Square implements Comparable<Square> { int [][]m; int difSd; int difSnd; int ddif; Square(...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
7f61193c7e012beb1a069c54278c1229
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
/* / フフ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ム / )\⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ Y (⠀⠀| ( ͡° ͜ʖ ͡°)⠀⌒(⠀ ノ (⠀ ノ⌒ Y ⌒ヽ-く __/ | _⠀。ノ| ノ。 |/ (⠀ー '_人`ー ノ ⠀|\  ̄ _人'彡ノ ⠀ )\⠀⠀ 。⠀⠀ / ⠀⠀(\⠀ #⠀ / ⠀/⠀⠀⠀/ὣ====================D- /⠀⠀⠀/⠀ \ \⠀⠀\ ( (⠀)⠀⠀⠀⠀ ) ).⠀) (⠀⠀)⠀⠀⠀⠀⠀( | / |⠀ /⠀⠀⠀⠀⠀⠀ | / [_] ⠀⠀⠀⠀⠀[___] */ // Main Code at the Bottom import ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
8adcbb48a5b8bdd35911661a80027e02
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.InputMismatchException; public class A { public static int getScore(int[][] mat, int N, boolean parity){ int total = 0; for(int i = 0; i<N; i++){ for(int j = 0; j<N; j++){ if(parity && (i + j) % 2 == mat[i][j]) total++; if(!parity...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
47f4914faf326b331db1d8a388b9cdb9
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.*; /** * Created by Admin on 2018-01-16. */ public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); /* int iloscSłow = in.nextInt(),iloscGrup = in.nextInt(),iloscKoncowychSlow = in.nextInt(); String [] słowa = new String[iloscSłow]...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
030c45539f6eb394f45acaef70c730d1
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
6a476b834a886e8e74c7b36556b0cd9d
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * @author Jenish */ public class Main { public static void main(String[] ARGS) { new Threa...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
537469eb2b7b42a3a43fe93f258d0025
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
//package mar18; import java.io.*; import java.util.*; public class HR27 { InputStream is; PrintWriter out; String INPUT = ""; //boolean codechef=true; boolean codechef=true; void solve() { int n=ni(); int[][][] mat=new int[4][n][n]; for(int i=0;i<4;i++) { for(int j=0;j<n;j++) { String s...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
2b4875ed8bf65a1dfef85e304dcecc13
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
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 * * @author Swatantra */ public class Main { public static void main(String[] args) { InputStream...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
af71eb00e16201b47c5413224087490f
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.*; import java.io.*; public class tr0 { static PrintWriter out; static StringBuilder sb; static int mod = 998244353; static long inf = (long) 1e18 + 1; static int[] col; static int n, m; static ArrayList<pair>[] ad; static long[][][] memo; static HashSet<Integer> h; static int[] a; static c...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
9ea5375654cbdbce524e8cded28800ee
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWri...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
797ee7f522b3204b38171bcdb480274b
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public final class ChessBoardCF { public static int min=Integer.MAX_VALUE; public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int first[][]=new int[n][n]; int second[][]=new int[n...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
75ec474840d050469b775743a13813e4
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.*; import java.util.*; /** * * @author akashvermaofskt * Coding is love <3! */ public class C { public static void main(String args[]) { try { int n=nextInt(); int A[][]=new int[n][n]; int B[][]=new int[n][n]; int C[][]=ne...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
6b1f621068a0f689bf167043881dffea
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Bit...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
523e940bc51cc56ff26d2b1e892db660
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import static java.lang.Math.min; import static java.lang.Math.sqrt; public class Chessboard implements Clos...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
905d3c7da806795bbc32254e7a0861e4
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
//package codeforces; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Scanner; public class Chessboard961 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); new Chessboard961().solve(scan, out); scan....
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
cba92254069d7f5c9af936596e86d6d9
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.lang.*; import java.math.BigInteger; import java.util.regex.*; public class Myclass { public static ArrayList a[]=new ArrayList[200001]; /*static boolean visited[]=new boolean [200001]; static int parent[]=new int[200001]; static int color[]=...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
c0925f1b3a68ac57277f737f588ab3fe
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.awt.geom.*; public class ChessBoard{ public static void fill(int[][] a, int n, MyScanner sc){ for(int i=0;i<n;i++){ String s=sc.next(); for(int j=0;j<n;j++) a[i][j]=s.charAt(j)-'0'; } } public static ...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
626981bbad1e99527e950c4437c18a7e
train_003.jsonl
1522850700
Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size n by n, n is always odd. And what's even worse, some squares were of wrong color. j-th square of the i-th row of k-th piece of the board has color ak, i, j; 1 being ...
256 megabytes
/** * http://codeforces.com/problemset/problem/961/C (Chessboard) * @author Alan Yan * */ import java.util.*; public class Task961C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.nextLine()); int ret = Integer.MAX_VALUE; int[][][] boards = new i...
Java
["1\n0\n\n0\n\n1\n\n0", "3\n101\n010\n101\n\n101\n000\n101\n\n010\n101\n011\n\n010\n101\n010"]
1 second
["1", "2"]
null
Java 8
standard input
[ "implementation", "bitmasks", "brute force" ]
dc46c6cb6b4b9b5e7e6e5b4b7d034874
The first line contains odd integer n (1 ≤ n ≤ 100) — the size of all pieces of the board. Then 4 segments follow, each describes one piece of the board. Each consists of n lines of n characters; j-th one of i-th line is equal to 1 if the square is black initially and 0 otherwise. Segments are separated by an empty li...
1,400
Print one number — minimum number of squares Magnus should recolor to be able to obtain a valid chessboard.
standard output
PASSED
ccbe3ee9296ddd9f2f999f805906d6dd
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.util.*; import java.io.*; public class _0780_E_UndergroundLab { static int N, M; static int ET[]; static int time = 0; static ArrayList<Integer> graph[]; static boolean vis[]; public static void main(String[] args) throws IOException { try { N = readInt(); M = readInt(); int K = readInt(); g...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
6991096230055a2ded98d48b83da9f73
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Task781C { static ArrayList<Integer>[] vertices; static boolean[] visited; static List<...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
a28a923a995e9f3f6655799b3dc664a4
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.*; import java.util.*; public class C { FastScanner in; PrintWriter out; int[] p; int get(int x) { return p[x] == x ? x : (p[x] = get(p[x])); } void unite(int x, int y) { p[get(x)] = get(y); } ArrayList<Integer>[] g; ArrayList<Integer> result = new ArrayList<Integer>(); void go(int v...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
526627b810b12e396247bbd7b2bce9c5
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.Arr...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
36ed5fe13197f5fb68d50acc3f13e71c
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.util.ArrayList; import java.io.UncheckedIOException; import java.util.List; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
3fda2cbb8299a270c44ee9725c4e4156
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Iterator; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; imp...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
8089e6796f3e28638b93847a29316203
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class C { Vector<Vector<Integer>> path; public void solve() throws IOException { InputReader in = new InputReader(System.in); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); path = new Vector<>...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
8405cf4b362ea2583f61d7cdba3eaa7f
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Set; import java.util.StringTokenizer; import java.util.TreeSet; ...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
a95020ebe2cdd6b70a431c241363e6fa
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.*; import java.util.*; public class pC { ArrayList<Integer>[] nei; boolean[] mark; ArrayList<Integer> path = new ArrayList<>(); void run() { int n = in.nextInt(); int m = in.nextInt(); int w = in.nextInt(); init(n); for (int i = 0; i < n; i++) { nei[i] = new ArrayList<>(); } for (...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
813299f205c2495dea62bce75372ec5d
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.*; import java.util.*; public class pC { ArrayList<Integer>[] nei; boolean[] mark; ArrayList<Integer> traverse; void run() { int n = in.nextInt(); int m = in.nextInt(); int w = in.nextInt(); nei = new ArrayList[n]; for (int i = 0; i < n; i++) { nei[i] = new ArrayList<>(); } for (i...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
6c181db78c27ab4852b0a2b0487e9fc2
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.*; import java.util.*; public class UndergroundLab { public static void main(String[] args) { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); adj = new List[n]; for (int i = 0; i < n; i++) { ad...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
ce4880da0173f3c315c6894a7f6a918f
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.*; import java.util.*; public class DFS_LAB { public static void main(String[] args) { // TODO Auto-generated method stub FastScanner input = new FastScanner(); int n = input.nextInt(); int edges = input.nextInt(); int clones = input.nextInt(); ArrayList<Integer>[] adjList = new ArrayList[...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
608f4e90861e41792d7ad8fe28011701
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.math.BigDecimal; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Locale; impo...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
42ec428544fc98eae606044c2374a27a
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { static int inf = (int) 1e9 + 7; static int n, k; static ArrayList<Integer> gr[], ans[]; static int id = 0; static boolean used[]; static int dfs(int v, int st) { if (st == (2 * n + k - 1) / k + 1)...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
57752761144401d837dd16cbd37b2e9f
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Writer; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
5a9b4073a79ba9fee526aa5d4bdb84e4
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.util.LinkedList; import java.io.InputStreamReader; import java.io.InputStream; ...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
9a9892135105fc74d57c0aebb2c3de41
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.TreeSet; import java.util.ArrayList; import java.io.Writer; i...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
36908f5dd0b3af1c17f47e80c37cd004
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.Arr...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
f68d15604b24c0e8d83dc6e922eefee2
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.TreeSet; import java.util.ArrayList; import java.io.Writer; i...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
2bec2221d6a9f205de12c7a776d3c293
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.Arr...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
f566ac48c5f48643c717cf6673df1cf1
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.util.InputMismatchException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.io.Writer; i...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
f6c9fdf898ef6c9d1a4b70302d453f2b
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.util.*; import java.io.*; public class C { List<Integer>[] graph; boolean[] vis; void go(int u) { vis[u] = true; addVertex(u); for (int t = 0; t < graph[u].size(); t++) { int v = graph[u].get(t); if (!vis[v]) { go(v); addVertex(u); } } } private void addVertex(int u) { re...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
429897ce31f3ce992efb89fd8614093e
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.concurrent.ConcurrentSkipListSet; public class Main { public static void main(String[] args) throws FileNotFoundException { ConsoleIO io = new ConsoleIO(new InputStreamReader(System.in), new PrintWriter(System.out)); // ...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
c50d8d1ad4fed1e040b143255f8f7377
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
// package codeforces.cf4xx.cf403.div1; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; public class C { public static void main(String[] args) { InputRe...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
e5fb8823003ed95bf0f6045a5aacec65
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
/* Did I say something wrong? Did you hear what I was thinking? Did I talk way too long when I told you all my feelings that night? Is it you? Is it me? Did you find somebody better? Someone who isn't me, 'cause I know that I was never your type Never really your type Overthinking's got me drinking Messing with my head...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
39f5ebbd72830f2d253ce4baaaea5a22
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.StringTokenizer; import java....
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
d38818a00f8bdbc914073abf2abe564a
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.StringTokenizer; import java....
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
1791b88d6fc9aa8af80d3801f086cb76
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.List; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExceptio...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
9838edfbff827c59c89901aca5082055
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.ArrayList; ...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
ae5de5899832cf50771af94e77fc747e
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.HashSet; import java.util.LinkedList; import java.util.Set; import java.util.StringTokenizer; public class R403D1P3 { public static void main...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
18b3305ea757fc038a93aa057a697d0f
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.stream.Str...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
7c935d41c0c6567cb911ef48cd5c6c43
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.List; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; import java.util.ArrayList; ...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
b0c2dc2235e9fbd983017c5c419a5731
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; /** * Built using CHelper plug-in * Actual soluti...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
e9fe14c7ff5037a8ea40345125f1bd84
train_003.jsonl
1488705300
The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that something fishy was going on there. He rallied fellow clones to go on a feud against the evil cor...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; /** * Built using CHelper plug-in * Actual soluti...
Java
["3 2 1\n2 1\n3 1", "5 4 2\n1 2\n1 3\n1 4\n1 5"]
1 second
["3 2 1 3", "3 2 1 3\n3 4 1 5"]
NoteIn the first sample case there is only one clone who may visit vertices in order (2, 1, 3), which fits the constraint of 6 vertices per clone.In the second sample case the two clones can visited vertices in order (2, 1, 3) and (4, 1, 5), which fits the constraint of 5 vertices per clone.
Java 8
standard input
[ "graphs", "constructive algorithms", "dfs and similar", "trees", "brute force" ]
d32d638e5f90f0bfb7b7cec8e541cf7d
The first line contains three integers n, m, and k (1 ≤ n ≤ 2·105, n - 1 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of vertices and edges in the lab, and the number of clones. Each of the next m lines contains two integers xi and yi (1 ≤ xi, yi ≤ n) — indices of vertices connected by the respective edge. The graph is allowed...
2,100
You should print k lines. i-th of these lines must start with an integer ci () — the number of vertices visited by i-th clone, followed by ci integers — indices of vertices visited by this clone in the order of visiting. You have to print each vertex every time it is visited, regardless if it was visited earlier or not...
standard output
PASSED
c83ea189670c057e2bd57b41feea5136
train_003.jsonl
1601903100
A famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, devised a game to help them:All of them take a sit at their round table, some of them with the golden ...
256 megabytes
//package bubblecup13.f; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class F2 { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni()...
Java
["4 2\n1 2\n2 2", "6 2\n2 3\n4 1", "3 2\n1 1\n2 2"]
1 second
["1", "1", "-1"]
NoteIn the third example the game has no end, because You always only have only one candidate, after whose splitting you end up in the same position as the starting one.
Java 11
standard input
[ "math" ]
bde1f233c7a49850c6b906af37982c27
The first line of input contains two integer numbers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 10^{9}$$$, $$$0 \le k \le 2\cdot10^5$$$), where $$$n$$$ denotes total number of pirates and $$$k$$$ is the number of pirates that have any coins. The next $$$k$$$ lines of input contain integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \le a_...
2,700
Print $$$1$$$ if the game is a good game: There is a way to do the splitting so the game ends after finite number of iterations. Print $$$-1$$$ if the game is a bad game: No matter how You do the splitting the game does not end in finite number of iterations.
standard output
PASSED
1153c0cff3f8b046a611a1c669525983
train_003.jsonl
1590676500
The game of Berland poker is played with a deck of $$$n$$$ cards, $$$m$$$ of which are jokers. $$$k$$$ players play this game ($$$n$$$ is divisible by $$$k$$$).At the beginning of the game, each player takes $$$\frac{n}{k}$$$ cards from the deck (so each card is taken by exactly one player). The player who has the maxi...
256 megabytes
import java.io.*; import java.util.*; public class Codeforces { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); int t=Integer.parseInt(bu.readLine()); while(t--...
Java
["4\n8 3 2\n4 2 4\n9 6 3\n42 0 7"]
2 seconds
["3\n0\n1\n0"]
NoteTest cases of the example are described in the statement.
Java 11
standard input
[ "greedy", "math", "brute force" ]
6324ca46b6f072f8952d2619cb4f73e6
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases. Then the test cases follow. Each test case contains three integers $$$n$$$, $$$m$$$ and $$$k$$$ ($$$2 \le n \le 50$$$, $$$0 \le m \le n$$$, $$$2 \le k \le n$$$, $$$k$$$ is a divisors of $$$n$$$).
1,000
For each test case, print one integer — the maximum number of points a player can get for winning the game.
standard output