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
059a4fe6e8a14a8ff2076c6562f570f7
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class CodeForces { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for (int i=0;i<t;i++){ int n=sc.nextInt(); int m=sc.nextInt(); int c=0; for (int x=0;x<n...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
ff8a7e7014f60f4361bf648d0d4281ee
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class ImmobileKnight { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while(T-->0){ int x = sc.nextInt(); int y = sc.nextInt(); System.out.println((++x/2)+" "+(...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
402ec4e0047da570c3173bff9efd5132
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int t= sc.nextInt(); for(int i=0;i<t;i++){ int n=sc.nextInt(); int m=sc.nextInt(); solve1739(n,m); } } p...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
4b39137608dac5598ec774b545b28ccd
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int t= sc.nextInt(); for(int i=0;i<t;i++){ int n=sc.nextInt(); int m=sc.nextInt(); solve1739(n,m); } } p...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
d1bf45c7cbcbc90c2a9613539aa25484
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
//package com.rajat.cp.codeforces.edu136; import java.util.Scanner; public class AImmobileKnight { public static void main(String args[]){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-- > 0) { int n = sc.nextInt(); int m = sc.nextInt(); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
dd5de3002e963fea84ee1de26ee7ad09
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
/*############################################################################################################ ########################################## >>>> Diaa12360 <<<< ############################################### ########################################### Just Nothing #################################...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
77f063692e3f63cb4743ef6d1b94751d
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
/*############################################################################################################ ########################################## >>>> Diaa12360 <<<< ############################################### ########################################### Just Nothing ###################################...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
25c7523b66e8279d7690a61ee73b76b9
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class Knight { public static void main(String [] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t>0) { t--; int n=sc.nextInt(); int m=sc.nextInt(); if(n==1||m==1) ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
f53a6fb88650a5e2419f3007c9c78bca
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int X[] = { 2, 1, -1, -2, -2, -1, 1, 2 }; int Y[] = { 1, 2, 2, 1, -1, -2, -2, -1 }; while(t...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
91d439439f68d42f07bc63e465d9fb9b
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class prog1 { static int[] solve(int n,int m) { int ans[] = new int[2]; if(n == 1 || m ==1) { ans[0] = 1; ans[1] = m; return ans; } if(n<=3 && m<=3) { ans[0] = n-1; ans[1] = m-1; return ans; } if(n == 3 && m==3) { ans[0] = 2; ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
fd296d3a57b0b848a9dae6455cd79808
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String [] args) { FastScanner fs=new FastScanner(); PrintWriter out=new PrintWriter(System.out); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
90c8e2b01c99d557036d1ddae8794624
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.io.*; public class tr0 { static StringBuilder sb; static int inf = (int) 1e9; static int mod = (int) 1e9 + 7; static int n, m, k; static TreeSet<Integer>[] ad, mult; static long[][][][] memo; static long[] f, val; static HashMap<Integer, Integer> hm; static ArrayLis...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
62a3463e727851d4df6b7d94e84fb152
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class D { private void solve() { int t = nextInt(); for (int tt = 0; tt < t; tt++) { int n = nextInt(); int m = nextInt(); int min = Math.mi...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
89819cf8f23e5c9a308e17fd8ba96dd5
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner in = new Scanner(System.in); long n = in.nextInt(); while (n-- > 0) { int m = in.nextInt(); int k = in.nextInt(); int[][] temp = new int[][]{{-1,-2},{1...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
2605f2dd179b51c6315886a54c093cc5
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while (tc-- > 0) { int n = sc.nextInt(); int m = sc.nextInt(); if (Math.max(n, m) == ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
be6d004d502fab66248b03fc7a95761e
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.StringTokenizer; public class Main { p...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
ec09411004c2eba2e22038fba7c54b71
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class Main{ public static void main(String [] args){ Scanner sc = new Scanner(System.in); int test = sc.nextInt(); for(int t=0;t<test;t++){ int n = sc.nextInt(); int m = sc.nextInt(); if (n == 1 || m == 1) { ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
b8d6c454aa80812e2dc8afd26887e9d7
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; public class Solution { public static void main(String args[]){ FastScanner sc = new FastScanner(); int t = sc.nextInt(); while(t-- > 0){ int n = sc.nextInt(); int m = sc.nextInt(); if(n >= 2 && m >= 2){ Sy...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
a89f95d17374ffe181a951280097275d
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class A { static class Pair { int f;int s; // Pair(){} Pair(int f,int s){ this.f=f;this.s=s;} } static class sortbyfirst implements Comparator<Pair> { public int compare(Pair a,Pair b) { r...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
9b82ed4fe07aeee14678f58bf00d0b81
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; /** * @author freya * @date 2022/9/6 **/ public class A{ public static Reader in; public static PrintWriter out; public static void main(String[] args) { out = new PrintWriter(new BufferedOutputStream(System.out)); in = new Reader(); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
2f6e1ab49242d98d66430c70a7a1c0bf
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class c1733 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t,j,i,n,m; //long a[]; t=sc.nextInt(); for(j=1;j<=t;j++){ n=sc.nextInt(); m=sc.nextInt(); if(n==1||m==1) ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
69c16d8083ae3ea78eba8a49e9b6352f
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class c1733 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t,j,i,n,m; //long a[]; t=sc.nextInt(); for(j=1;j<=t;j++){ n=sc.nextInt(); m=sc.nextInt(); if(n==1||m==1){ ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
441889b09479c9efcf0ba23d1699a2ac
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class ImmobileKnight { public static void main(String[] args) { Scanner obj = new Scanner(System.in); int nTest = obj.nextInt(); while (nTest-- > 0) { int row = obj.nextInt(); int col = obj.nextInt(); Cell ans =...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
3af2030aa18434392705b139cc22fece
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class ImmobileKnight { public static void main(String[] args) { Scanner obj = new Scanner(System.in); int nTest = obj.nextInt(); while (nTest-- > 0) { int row = obj.nextInt(); int col = obj.nextInt(); Cell ans =...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
4bcec1805e6465cc43c04c267fad0b32
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { BufferedReader rd=new BufferedReader(new InputStreamReader(System.in)); int t=Integer....
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
2cb768f8505a9e7eb8a9c176146a4983
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class Solution{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++){ int n=sc.nextInt(); int m=sc.nextInt(); if(n==1 || m==1){ System.out.pr...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
b0396023b33c33ad995f3fdec255b143
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.io.*; import java.lang.*; public class main1{ FastScanner in; PrintWriter out; public static void main(String[] arg) { new main1().run(); } //////////////SOLVE QUESTIONS HERE///////////// ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
89d6ebd778c184021c250d3c2fbe418f
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.io.*; public class Contest { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); int m = sc.nextInt(); if (n > 8 ||...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
980ac4cad00364bd044258b2a2ddbb46
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
// "static void main" must be defined in a public class. import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) { FastScanner fs=new FastScanner(); PrintWriter out=new PrintWriter(System.out); int T = fs.nextInt(); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
fa9cbf54a404fd1ebd51badc6d07eaaa
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class Rough { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int r = sc.nextInt(), c = sc.nextInt(); int min = Math.min(r, c), max = Math.max(r, c); if...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
7520b0cd666801edafc7c2960bc94550
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class Main { public static void main(String[] args) { FastScanner s = new FastScanner(); int o = s.nextInt(); while(o-->0){ ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
c0961016b855cf117170d33b8a608368
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class main //class contest { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
fab7f11b3d677340cb49e267b6007325
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class Solution { static MyScanner str = new MyScanner(); // static Scanner str = new Scanner(System.in); public s...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
9ea8706a07d6e77ada839e36d9358382
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Main { public static void main(String[] args) throws IOException{ FastScanner fs=new FastScanner(); Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStream...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
dd63e4d2ac418cfbdc5fa31d04f16475
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class Test12 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int k; for (k = 0; k < t; k++) { int n = sc.nextInt(); int m = sc.nextInt(); int flag = 0...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
4fad17c96d2fdf3331ab51524b0273b2
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException, InterruptedException { Scanner sc = new Scanner(new BufferedInputStream(System.in)); PrintWriter pw = new PrintWriter(System.out); int t = sc.nextInt(); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
6d18999aa02e3ef6ac3d84127a7f9765
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class CF { public static void main(String[] args) { Scanner in = new Scanner(System.in); short n = in.nextShort(); for (n=n; n > 0; n--) { short x, y; x = in.nextShort(); y = in.nextShort(); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
449e58b62c1476ef8193aa5cf94f3276
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; /** * @author 温志森 * @version 1.0 */ public class Immobile_Knight { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int time=scanner.nextInt(); int n, m; for (int i = 0; i < time; i++) { n=scanner...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
00d6164bcf6ac72f463512607ed7e09d
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t=sc.nextInt(); while(t-- > 0){ int r=sc.nextInt(); int c=sc.nextInt(); System.out.println((r / 2 + 1) + " " + (c ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
c94df3937ab38b29bbfc84fef8e9689f
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.InputStreamReader; import java.util.*; public class Main { static Scanner cin = new Scanner(new InputStreamReader(System.in)); public static void main(String[] args) { int t = cin.nextInt(); for (int i=1;i<=t;i++) { solve(); } } private ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
022509b6a75ca9297a8d54fe799cef8e
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class ImmobileKnight { public static void main(String args[]) throws Exception { Scanner s = new Scanner(System.in); int testcases = Integer.parseInt(s.nextLine()); while (testcases > 0) { int row = s.nextInt(); int ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
532d2722ab9f2b50f9686a860806377d
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.text.ParseException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import ja...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
80dbbecf725748194daf8dcc9eaea7e8
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static final int[] dx = {}; private static final int[] dy = {}; private static void solve(int n, int m){ int min = Math.min(n, m); int max = Math.max(n, m); if(min <= 1){ out.println("1 1"); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
f93616d68e700cf9cb8e24e383c391aa
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class ImmobileKnights { public static void immobileKnights(int n , int m){ if (n==1 || m == 1){ System.out.println(n + " " + m); return; } if (n<=3 && m<=3){ System.out.println("2 2"); return; ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
746a962fd6f2d943e5e064e65958866f
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class tasks { public static void main(String... args){ Scanner in=new Scanner(System.in); int t=in.nextInt(); int n=0,m=0; for(int i=0;i<t;i++){ n=in.nextInt(); m=in.nextInt(); if(n==1||m==1){ ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
68c5a365c8a8f69d0fa197e07f54d6a2
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
// Java program to find length of the longest valid // substring import java.util.*; public class A1739 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int tt=0;tt<t;tt++) { int n = sc.nextInt(); int m = sc...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
7b42e8a2f3428e54d155bcf22cf4e0dc
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
de7674ae224e17253143bda5f285c94d
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; @SuppressWarnings("unused") public class A_Immobile_Knight { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(), m ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
c4b992aac15e037d207bfd9245d2b524
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; @SuppressWarnings("unused") public class A_Immobile_Knight { public static void main(String[] args) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(), m ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
fee110536651f3d61e95842d6830bf05
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class Test{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); int m = sc.nextInt(); if(n >=4 && m>=4) ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
2f0ec24ed91c9d88435c21e440c02b72
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class ImmobileKnight { private static final int START_TEST_CASE = 1; public static void solveCase(FastIO io, int testCase) { final int N = io.nextInt(); final int M = io.nextInt(); if (N >= 4 || M >= 4) { io.println(1, 1); } else { io.print...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
cf5d29999a24e4cd8d17818c336d3228
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class ImmobileKnight { private static final int START_TEST_CASE = 1; private static final int[] DR = {-2, -1, 1, 2, 2, 1, -1, -2}; private static final int[] DC = {1, 2, 2, 1, -1, -2, -2, -1}; public static void solveCase(FastIO io, int testCase) { final...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
0d19b6561b2bbf5f077d2fa4e585823d
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.HashSet; import java.util.LinkedList; public class Main { static InputReader in; static OutputWriter out; public static void main(String[] args) throws Exception { in=new InputReader(System.in); out=new OutputWriter(System.out); int...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
0003fa5b14444e9aee7a5f1d72dd6631
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; @SuppressWarnings("unchecked") public class CodeForces{ public static void main(String[] args){ Scanner input = new Scanner(System.in); int t = input.nextInt(); while(t-- > 0)...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
c4ae5246fcb60aaa2b3cb6aad74745b0
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class ImmobileKnight { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-->0) { int n = sc.nextInt(), m = sc.nextInt(); if(n==1 || m==1) System.out.println(n+" "+m);...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
ebcd0afe9a3543a598ae3394b0bbcc20
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); input.nextLine(); for(int i = 1; i <= t; i++){ String s = input.nextLine(); String[...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
2396ff995e849bf7a4db4cc4330244a3
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class _136A { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int i = 0; i < t; ++i){ int n = in.nextInt(); int m = in.nextInt(); if (n <= 3 && m <= 3){ ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
d08dab52d924d2936772b8fb3291c7a0
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
// Author MAVERICK // https://codeforces.com/contest/1348/submission/119576836 //com.package.Maverick.java; import java.util.*; import java.io.*; import java.lang.*; // codechef no public declaration public class Maverick{ // constants static int counter = 0; static boolean flag = false; st...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
522cfb16ed774f97da74d2f02d631ef2
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class contest { public static void main(String args[]){ Scanner sc =new Scanner(System.in); int n=sc.nextInt(); for(int i=0;i<n;i++){ int r=sc.nextInt(); int c=sc.nextInt(); if(r==3&&c==3){ System.out.println(2+" "+...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
3d3f6591d81a210d78e5f19ae4122b80
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Scanner; public class A{ public static int xdir[]=new int[]{-2,-1,1,2,2,1,-1,-2}; public static int ydir[]=new int[]{1,2,2,1,-1,-2,-2,-1}; public static boolean isPossible(int i,int j,int n,int m){ boolean flag=false; for(int k=0;k<8;k++){ if(i+xdir[k]>=...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
ae4f891788437240419223a093b7f3de
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class Codechef{ public static void main(String args[]) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int tc = Integer.parseInt(br.readLine()); while(tc-->0){ String s[] = br.readLine...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
0769186a45d3e2c4ec58e743feb1f622
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in=new Scanner (System.in); int t=in.nextInt(); while(t>0) { int a=in.nextInt(),b=in.nextInt(); if(a<=3||b<=3) System.out.println(((a/2)+1)+" "+((b/2)+1)); else System.out.println...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
05fc5d611ba402b26081e717d0a11ea0
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class CD { int [] arrr; public static void main(String[] args) { Scanner st = new Scanner(System.in); int t = st.nextInt(); while (t-- > 0){ int n = st.nextInt();int m = st.nextInt(); if (n < 4 && m < 4){ Sys...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
fd5dc48d3e3228dd8215b2f737b18a1f
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { // your code goes here Sca...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
a504c60b11a61094028f4feb3795bf85
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Solution{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); int m = sc.nextInt(); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
129926c0a2854359b241e33ef9e0663d
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class cf { public static void main(String[] args) { Scanner css = new Scanner(System.in); int t = css.nextInt(); for (int i = 0; i < t; i++) { int n = css.nextInt(), m = css.nextInt(); if((n == 1 && m >= 1) || (m == 1 && n >= 1)){ ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
70c39906d17a3bac27f9ebf97995f23f
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
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.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class A { static final int mo...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
1131b785ae98bc11897694e845afec2b
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class A{ public static void main(String args[]){ Scanner Sc=new Scanner(System.in); int t=Sc.nextInt(); while(t-->0) { int n=Sc.nextInt(); int m=Sc.nextInt(); if(n==1|| m==1) { System.out.println("1 1"); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
b69e6e35d58a359f7f5429e69629e73a
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Round22 { // -----------------------------------stuff----------------------------------------------------- public static void main(String[] args) throws IOException { Scanner scanner=new Scanner(System.in);...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
da6e0948252ff952d3a9628d991142f0
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; import java.util.StringTokenizer; public class mm { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
49f78ae25ab5a8cda07c7ca6304fc525
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.lang.*; import java.io.*; import java.util.*; public class Codeforces { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); int T = Integer.parseInt(br.re...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
2552054e64a9f365ad0eb8285552bd65
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class A { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
d44a29c897feab41239064bea398fff2
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while (T-- > 0) { int N = sc.nextInt(); int M = sc.nextInt(); System.out.println((N / 2 + 1) + " " + (M...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
fd48ec71aadacf30ba1403a16959afac
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { new Thread(null, () -> new Main().run(), "1", 1 << 23).start(); } private void run() { FastReader scan = new FastReader(); PrintWriter out = new PrintWriter(System.out); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
5395bc0485bf991e51161ffd382b92b1
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int t; t = cin.nextInt(); while (t-- > 0) { int n = cin.nextInt(), m = cin.nextInt(); int ans1 = ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
9068e5077288b4c1526754689a7f1287
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static PrintWriter pw; public static void main(String[] args) throws IOException, InterruptedException { Scanner sc = new Scanner(System.in); pw = new PrintWriter(System.out); int t =sc.nextInt(); while(t-->0) { int r =sc.ne...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
db744dcef243b4b50884ede33b3107cd
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.PrintWriter; import java.lang.*; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.security.spec.RSAOtherPrimeInfo; import java.util.*; public class First { static int k; static int c = 0; ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
233ddf8857daaf93a435a328419e52e5
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class ImmobileKnight { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); for (int i = 1; i <= t; i++) { ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
dd267469613e3e5d4a5a14e69dea45a6
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.text.*; public class Main{ public static void main(String args[]) throws IOException{ Read sc=new Read(); int n=sc.nextInt(); for(int i=0;i<n;i++){ int a=sc.nextInt(); int b=sc.nextInt(); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
0c8d11a529a9fa2b17a724a5fa773615
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.time.*; import static java.time.temporal.ChronoUnit.MINUTES; import javafx.util.Pair; public class Program { public static void print(Object str) { ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
0b47cf8894030f20e7553e6e6536029d
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) { FastScanner input = new FastScanner(); int tc = input.nextInt(); work: ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
e8a72ee0f8f6ae9f1335f43d3017a309
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) throws IOException { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { int n=sc.nextInt(); int m=sc.nextInt(); if(n==1||m==1) System.out.println...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
c9d1ad2f3a68a09c6fe78d0b8b3a0d97
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class C { public static void main(String[] args) { FastScanner sc = new FastScanner(); PrintWriter out = new PrintWriter(System.out); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
3d75903b0b5d7e6ecb498060675b2d12
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class cp { static PrintWriter w = new PrintWriter(System.out); static FastScanner s = new FastScanner(); static int mod = 1000000007; static class Edge { int src; int wt; int nbr; Edge(int src, int nbr, in...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
a58b64faba0b3c6824e6304af4c4e5e0
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader bf; static PrintWriter out; static Scanner sc; static StringTokenizer st; static long mod = (long)(1e9+7); static long mod2 = 998244353; static long fact[]; static long inverse[]; public static void main (String[...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
32079050c0751e5636f144ee01575679
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String ne...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
387048ac2114ed37ac7ef4a85ffe93af
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static Scanner sc; static PrintWriter pw; public static void main(String[] args) throws Exception { pw = new PrintWriter(System.out); sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(), m = sc.ne...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
ee034352d5d9db2b3a18f61f9da58381
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String args[]) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
e8bb15634a47996ec362f5bf20a77be7
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.time.Clock; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Arrays; imp...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
93b0fe08c79f9c27b6af0e59483b934e
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class Solution { static Scanner sc=new Scanner(System.in); public static void main (String[] args) throws java.lang.Exception { int t; t = sc.nextInt(); while(t-- != 0){ int n,m; n = sc.nextInt(); m = sc.nextInt(); System.out.println((n/2+1) + " " + (m/2+1))...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
19fc51f57183d7b07f88b15bad00dfda
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int x=0;x<t;x++){ int r=sc.nextInt();int c=sc.nextInt(); if(r==1 || c==1) System.out.println(1+" "+1); else if((r<3 && c>3) || (c<3 &&...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
ce6a2d3ec182c968837470993d9f3e1e
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.lang.*; public class codeforces { public static void main(String[] args) { Scanner ob=new Scanner(System.in); int t=ob.nextInt(); for(int z=0;z<t;z++) { int a=ob.nextInt(); int b=ob.nextInt(); if(a==1...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
670fae7af41007843c92dbfad2ee3964
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) throws IOException { FastReader in = new FastReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int t = in.nextInt(); for (int tt = 0; tt <...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
7ad0b84de56593e46cb1ac2305b001d1
train_109.jsonl
1664462100
There is a chess board of size $$$n \times m$$$. The rows are numbered from $$$1$$$ to $$$n$$$, the columns are numbered from $$$1$$$ to $$$m$$$.Let's call a cell isolated if a knight placed in that cell can't move to any other cell on the board. Recall that a chess knight moves two cells in one direction and one cell ...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static int T,N,M; static int[] dx={-1,-2,-2,-1,1,2,2,1}; static int[] dy={-2,-1,1,2,2,1,-1,-2}; public static void main(String[] args) throws Exception{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); ...
Java
["3\n\n1 7\n\n8 8\n\n3 3"]
2 seconds
["1 7\n7 2\n2 2"]
NoteIn the first testcase, all cells are isolated. A knight can't move from any cell of the board to any other one. Thus, any cell on board is a correct answer.In the second testcase, there are no isolated cells. On a normal chess board, a knight has at least two moves from any cell. Thus, again, any cell is a correct ...
Java 8
standard input
[ "implementation" ]
e6753e3f71ff13cebc1aaf04d3d2106b
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 64$$$) — the number of testcases. The only line of each testcase contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 8$$$) — the number of rows and columns of the board.
800
For each testcase, print two integers — the row and the column of any isolated cell on the board. If there are no such cells, print any cell on the board.
standard output
PASSED
279ea7796b12ef78c80181bf3bf95a03
train_109.jsonl
1664462100
You are given a rooted tree, consisting of $$$n$$$ vertices. The vertices are numbered from $$$1$$$ to $$$n$$$, the root is the vertex $$$1$$$.You can perform the following operation at most $$$k$$$ times: choose an edge $$$(v, u)$$$ of the tree such that $$$v$$$ is a parent of $$$u$$$; remove the edge $$$(v, u)$$$;...
256 megabytes
import java.util.*; import java.io.*; public class Main { static Scanner sc; static PrintWriter pw; static int depth[][], par[]; static boolean[] vis; static void dfs(int u) { vis[u] = true; if (u == 0) return; if (vis[par[u]]) { depth[u][0] = 1 + depth[par[u]][0]; depth[u][1] = u; ...
Java
["5\n\n5 1\n\n1 1 2 2\n\n5 2\n\n1 1 2 2\n\n6 0\n\n1 2 3 4 5\n\n6 1\n\n1 2 3 4 5\n\n4 3\n\n1 1 1"]
4 seconds
["2\n1\n5\n3\n1"]
null
Java 8
standard input
[ "binary search", "data structures", "dfs and similar", "graphs", "greedy", "trees" ]
f260d0885319a146904b43f89e253f0c
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$0 \le k \le n - 1$$$) — the number of vertices in the tree and the maximum number of operations you can perfo...
1,900
For each testcase, print a single integer — the smallest height of the tree that can achieved by performing at most $$$k$$$ operations.
standard output
PASSED
4043dcc8f52fcc15a8eddb0099dfb60e
train_109.jsonl
1664462100
You are given a rooted tree, consisting of $$$n$$$ vertices. The vertices are numbered from $$$1$$$ to $$$n$$$, the root is the vertex $$$1$$$.You can perform the following operation at most $$$k$$$ times: choose an edge $$$(v, u)$$$ of the tree such that $$$v$$$ is a parent of $$$u$$$; remove the edge $$$(v, u)$$$;...
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.function.Function; import java.io.Writer; import ja...
Java
["5\n\n5 1\n\n1 1 2 2\n\n5 2\n\n1 1 2 2\n\n6 0\n\n1 2 3 4 5\n\n6 1\n\n1 2 3 4 5\n\n4 3\n\n1 1 1"]
4 seconds
["2\n1\n5\n3\n1"]
null
Java 8
standard input
[ "binary search", "data structures", "dfs and similar", "graphs", "greedy", "trees" ]
f260d0885319a146904b43f89e253f0c
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$0 \le k \le n - 1$$$) — the number of vertices in the tree and the maximum number of operations you can perfo...
1,900
For each testcase, print a single integer — the smallest height of the tree that can achieved by performing at most $$$k$$$ operations.
standard output
PASSED
e2175a7e41e9b43e9f81153040214b01
train_109.jsonl
1664462100
You are given a rooted tree, consisting of $$$n$$$ vertices. The vertices are numbered from $$$1$$$ to $$$n$$$, the root is the vertex $$$1$$$.You can perform the following operation at most $$$k$$$ times: choose an edge $$$(v, u)$$$ of the tree such that $$$v$$$ is a parent of $$$u$$$; remove the edge $$$(v, u)$$$;...
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.function.Function; import java.io.Writer; import ja...
Java
["5\n\n5 1\n\n1 1 2 2\n\n5 2\n\n1 1 2 2\n\n6 0\n\n1 2 3 4 5\n\n6 1\n\n1 2 3 4 5\n\n4 3\n\n1 1 1"]
4 seconds
["2\n1\n5\n3\n1"]
null
Java 8
standard input
[ "binary search", "data structures", "dfs and similar", "graphs", "greedy", "trees" ]
f260d0885319a146904b43f89e253f0c
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$0 \le k \le n - 1$$$) — the number of vertices in the tree and the maximum number of operations you can perfo...
1,900
For each testcase, print a single integer — the smallest height of the tree that can achieved by performing at most $$$k$$$ operations.
standard output
PASSED
431f55284d8dc55c91c4817b6310800a
train_109.jsonl
1664462100
You are given a rooted tree, consisting of $$$n$$$ vertices. The vertices are numbered from $$$1$$$ to $$$n$$$, the root is the vertex $$$1$$$.You can perform the following operation at most $$$k$$$ times: choose an edge $$$(v, u)$$$ of the tree such that $$$v$$$ is a parent of $$$u$$$; remove the edge $$$(v, u)$$$;...
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 jav...
Java
["5\n\n5 1\n\n1 1 2 2\n\n5 2\n\n1 1 2 2\n\n6 0\n\n1 2 3 4 5\n\n6 1\n\n1 2 3 4 5\n\n4 3\n\n1 1 1"]
4 seconds
["2\n1\n5\n3\n1"]
null
Java 8
standard input
[ "binary search", "data structures", "dfs and similar", "graphs", "greedy", "trees" ]
f260d0885319a146904b43f89e253f0c
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$0 \le k \le n - 1$$$) — the number of vertices in the tree and the maximum number of operations you can perfo...
1,900
For each testcase, print a single integer — the smallest height of the tree that can achieved by performing at most $$$k$$$ operations.
standard output
PASSED
73d4a363dd39e45bc76b1d220e65d03c
train_109.jsonl
1664462100
You are given a rooted tree, consisting of $$$n$$$ vertices. The vertices are numbered from $$$1$$$ to $$$n$$$, the root is the vertex $$$1$$$.You can perform the following operation at most $$$k$$$ times: choose an edge $$$(v, u)$$$ of the tree such that $$$v$$$ is a parent of $$$u$$$; remove the edge $$$(v, u)$$$;...
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 jav...
Java
["5\n\n5 1\n\n1 1 2 2\n\n5 2\n\n1 1 2 2\n\n6 0\n\n1 2 3 4 5\n\n6 1\n\n1 2 3 4 5\n\n4 3\n\n1 1 1"]
4 seconds
["2\n1\n5\n3\n1"]
null
Java 8
standard input
[ "binary search", "data structures", "dfs and similar", "graphs", "greedy", "trees" ]
f260d0885319a146904b43f89e253f0c
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$0 \le k \le n - 1$$$) — the number of vertices in the tree and the maximum number of operations you can perfo...
1,900
For each testcase, print a single integer — the smallest height of the tree that can achieved by performing at most $$$k$$$ operations.
standard output
PASSED
6ef40112dd1bbd6ee05057fd7928386e
train_109.jsonl
1664462100
You are given a rooted tree, consisting of $$$n$$$ vertices. The vertices are numbered from $$$1$$$ to $$$n$$$, the root is the vertex $$$1$$$.You can perform the following operation at most $$$k$$$ times: choose an edge $$$(v, u)$$$ of the tree such that $$$v$$$ is a parent of $$$u$$$; remove the edge $$$(v, u)$$$;...
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.function.Function; import java.io.Writer; import ja...
Java
["5\n\n5 1\n\n1 1 2 2\n\n5 2\n\n1 1 2 2\n\n6 0\n\n1 2 3 4 5\n\n6 1\n\n1 2 3 4 5\n\n4 3\n\n1 1 1"]
4 seconds
["2\n1\n5\n3\n1"]
null
Java 8
standard input
[ "binary search", "data structures", "dfs and similar", "graphs", "greedy", "trees" ]
f260d0885319a146904b43f89e253f0c
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of testcases. The first line of each testcase contains two integers $$$n$$$ and $$$k$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$0 \le k \le n - 1$$$) — the number of vertices in the tree and the maximum number of operations you can perfo...
1,900
For each testcase, print a single integer — the smallest height of the tree that can achieved by performing at most $$$k$$$ operations.
standard output