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 | 40d9c3f2e9ef58c8615f87f64e9fd662 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 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.*;
import java.util.function.BiFunction... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 8 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | c7918fd3afbb33672e28bdc6e2d1c0ad | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
static char[][][] comp = {
{{'-', '.', '.', '.'},
{'.', '.', '*', '.'},
{'.', '*', '*', '.'},
{'.', '.', '.', '.'}},
{{'.', '.', '.', '.'},
... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 8 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 5729ac8a95159380d3d0e71d20e1ce4a | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.util.*;
import java.io.*;
public class F {
static FastReader sc;
static void solve() {
StringBuilder res = new StringBuilder();
int n = sc.nextInt();
int m = sc.nextInt();
char[][] arr = new char[n][m];
for (int i = 0; i < n; i++) {
a... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 8 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | a915d8de4c87de009f1215813841d192 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | //package codeforces.round817div4;
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class F {
static InputReader in;
static PrintWriter out;
public static void main(String[] args) {
//initReaderPrinter(true);
initReaderPrinter(false);
sol... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 8 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 6934b73d1bb6950a21073e41bfcfb34f | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static void main(String[] args){
MyScanner scanner = new MyScanner();
int numOfTests = scanner.nextInt();
for(int t = 1; ... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 8 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | b859c44da14781080c058a2df13dfe06 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.util.*;
import java.io.*;
public class myclass
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
new InputStreamReader(System.in));
}
String... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 8 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 5b36bbd0651c52114b0e4843f31e105e | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
Reader in = new Reader();
PrintWriter out = new PrintWriter(System.out);
int T = in.nextInt();
for (int t = 0; t < T; t++) {
int N = in.... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 8 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | e61b1bf5f12e9e78d3583a75d4cd8178 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class P1722F {
public static class Point {
int r;
int c;
public Point(int r, int c) {
this.r = r;
this.c = c;
}
}
static int[] d... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 78b91e2b3cd6db044b92f03bde41c02b | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes |
import java.util.*;
import java.io.*;
public class f {
//FastReader
public static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 3b5fdf3cab8b07fb09bdf0a57c367261 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.math.BigInteger;... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 7294a94a4217e375cdcfd2f16bbf4c83 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | // package c1722;
//
// Codeforces Round #817 (Div. 4) 2022-08-30 07:50
// F. L-shapes
// https://codeforces.com/contest/1722/problem/F
// time limit per test 1 second; memory limit per test 256 megabytes
// public class Pseudo for 'Source should satisfy regex [^{}]*public\s+(final)?\s*class\s+(\w+).*'
//
// An L-shap... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 0d49ae16d1be49a101656a488e82b8c1 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Main {
static int[] dx = {-1,0,1};
static int[] dy = {-1,0,1};
public static void main(String arg[]) throws IOException {
BufferedRead... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | ee90daa94226eb9069762cf8f94e4a3a | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
//4
public class Main {
static int[] dx = {-1,0,-1};
static int[] dy = {-1,0,1};
public static void main(String arg[]) throws IOException {
Buffered... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 54c7415e0dcb6c8fd646765047ae23c0 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static int[][] dirs =new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};
public static int[][] cdir = new int[][]{{0, 0}, {0, 1}, {... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 11cec21eee7b267124ca3fd714c2e7aa | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.*;
import java.util.StringTokenizer;
public class copy {
static int log=30;
static int[][] ancestor;
static int[] depth;
static void sieveOfEratosthenes(int n, ArrayList<Integer> arr) {
boolean prime[] = new boolean... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 865c3a34743fa519a0a9e9ab0e33792d | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static int INF = 0x3f3f3f3f, mod = 1000000007, mod9 = 998244353;
public static void main(String args[]){
try {
PrintWriter o = new PrintWriter(System.out);
boolean multiTest = true;
// init
... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | c3e370cc2fe05331587189acba5204e0 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.lang.*;
public class Main {
public static void main(String[] args) throws IOException{
FastReader s = new FastReader();
int t = s.nextInt();
outer: while(t-... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | f0d6d8daa3122fb43c4945920880f4c5 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;
import... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 4fba2ec0f01f1c4ceb51d09e9d6529c9 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.util.*;
import java.io.*;
public class sol {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static int floodfill(char[][] grid, boolean[][] visited, int i, int j) {
int visitedCnt = 1;
Stack<int[]> s = new Stack<>();
s.push(new int[... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | cdff9f0d829a58f8fbbfad5546736cfe | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import javax.print.attribute.IntegerSyntax;
import java.util.*;
import java.io.*;
public class Solution
{
private static class FastIO {
private static class FastReader
{
BufferedReader br;
StringTokenizer st;
FastReader()
{
... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 10a53e4a380ddaa7140e86d6829436c1 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static ContestScanner sc = new ContestScanner(System.in);
static PrintWriter pw = new PrintWriter(System.out);
static StringBuilder sb = new StringBuilder();
public static void main(String[] args) throws Exception {
int T = sc.... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 5b8f853fb10c9049ad707aff9598ca45 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class F1722 {
static int[] dx;
static int[] dy;
static boolean[][] seen;
static boolean[][] arr;
static int[][] val;
public static void main(String[] args) throws IOException{
StringBuffer ans = new StringBuffer... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 8da161fdb25f76f55431bb4bc9b2dfdc | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
public static boolean surrup(String[] ar, int n, int m, int r, int c) {
if (r > 0) {
if (ar[r-1].charAt(c) == '*') {
return true;
}
}
return false;
}
public static boole... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | cef4997abf1352983e6ab5ac167e1b9d | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
public static boolean surrup(String[] ar, int n, int m, int r, int c) {
if (r > 0) {
if (ar[r-1].charAt(c) == '*') {
return true;
}
}
return false;
}
public static boole... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | cfb2cf4c4f27db1e9ce6d54b1a392709 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static Reader r = new Reader();
static StringBuilder sb = new StringBuilder();
static int n,m;
static int grid[][];
static int cnt;
static int nb[][];
static boolean visited[][];
static int[] dx = {-1,1,0,0,-1,-1,1,1};... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 16193755d9e38e9d27cace932266f335 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.concurrent.ThreadLocalRandom;
/*
3 2 1 4
3 1 4 2 //1
3 4 2 1 //2
4 2 1 3 //3
000
001
010
011
100
101
110
111
1 2 3 4 5 6
1 3 6 10 15 21
*/
pu... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 82e62ba5bc323b1a61d3ebc89ca294fd | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;
import... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 10d72dcd76953ac86f042ee248fc9285 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static FastReader scanner = new FastReader();
static int[] dx = new int[]{-1, -1, -1, 0, 0, 1, 1, 1};
static int[] dy = new int[]{-1, 0, 1, -1, 1, -1, 0, 1};
static int[] topLeft = new int[]{0, 1, 2, 3, 5};
static int[] topRight ... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | c176d80b388b88ab73cff04905d951b7 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.*;
public class L_shapes {
static FastScanner fs;
static FastWriter fw;
static boolean checkOnlineJudge = System.getProperty("ONLINE_JUDGE") == null;
private static final int[][] kdir = new int[][]{{-1, 2}, {-2, 1}, {-2, -1}, {-1, -2}, {1, -2}, {2, -1}, {2,... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | ff6327e1e70df5e4e219aa6df122847b | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
public class Codeforces {
public static void main(String[] args) {
FastReader fastReader... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 7761a63c5d6488d4206d9da978f7b2c5 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | ///WizardAP - 当你休息的时候,很多人比你付出更多的努力!不放弃 !
/// Time : 2022-10-12, Wed, 16:54
import java.io.*;
import java.util.*;
import static java.lang.Double.parseDouble;
import static java.lang.System.in;
import static java.lang.System.out;
public class Main {
static final int MOD = (int) 1e9 + 7;
public static boolean ... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | c8c5845eead150d46b29df32aea57fcc | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.lang.Math;
import java.util.*;
import java.util.regex.Pattern;
import javax.swing.text.DefaultStyledDocument.ElementSpec;
public final class Solution {
private static class FastScanner {
private final int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
priv... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 386f85914c1bf0e1f35738e1ffc76112 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes |
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main{
static int n = 0,m = 0;
static boolean [][]v = new boolean [55][55];
static char[][]g = new char[55][55];
static StreamTokenizer st ;
static BufferedReader re = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 528b002babff08a93a8c3e74cbf32655 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class F {
public static void main(String[] args)throws IOException {
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(bf.readLine());
whi... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | cb63e4924a492e84f977d990b5b98385 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.*;
public class lshapes {
static char[][] arr;
static boolean[][] visited;
static int n;
static int m;
static boolean valid;
static final int R_CHANGE[] = {0, 1, 0, -1};
static final int C_CHANGE[] = {1, 0, -1, 0};
static final int R_CHANGE2[] = {-1, 1... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 8bacc9514de420f70dc01916ea4f7ba2 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Lshapes {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedR... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 45ffb1395eba788385bcfe98088ebfe3 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | //some updates in import stuff
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import java.util.*;
import java.io.*;
import java.math.*;
//key points learned
//max space ever that could be alloted in a program to pass in cf
//int[][] prefixSum = new int[... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 6c959da72d0f525d50a7ea02820e5082 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static int INF = 0x3f3f3f3f, mod = 1000000007, mod9 = 998244353;
public static void main(String args[]){
try {
PrintWriter o = new PrintWriter(System.out);
boolean multiTest = true;
// init
... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 9b81b756f126c70729e1b1516378233d | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | // JAI SHREE RAM, HAR HAR MAHADEV, HARE KRISHNA
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.*;
import java.lang.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.io.*;
public class CodeForces {
static private final String INPUT = "input.txt";
s... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 2ab2e707ee14b081851ece5652cc009b | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes |
import java.io.*;
import java.lang.*;
import java.util.*;
public class F1722 {
static int[] dx;
static int[] dy;
static boolean[][] seen;
static boolean[][] arr;
static int[][] val;
public static void main(String[] args) throws IOException{
StringBuffer ans = new StringBuff... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | ba12fbe109dab52e00d0f92f6afd7be6 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | /*
_oo0oo_
o8888888o
88" . "88
(| -_- |)
0\ = /0
___/`---'\___
.' \\| |// '.
/ \\||| : |||// \
/ _||||| -:- |||||- \
... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | b3db59a20c1df2f4909573899843b01f | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
static int globalVariable = 123456789;
static String author = "pl728 on codeforces";
public static void main(String[] args) {
FastReader sc = new FastReader();
... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 5b42bc7ae37e19158e0d014c5f916601 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | /*LoudSilence*/
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Solution {
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
static FastScanner ... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 4772f21475e2c2d586826c2355e78e6b | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.util.*;
// @author : Dinosparton
public class test {
static class Pair{
long x;
int y;
Pair(long x,int y){
this.x = x;
this.y = y;
}
}
static class Compare {
... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | b37b4e1fa73ae19cd683d20317762b75 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;
public class Main {
static AReader scan = new AReader();
static int N =... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 55d20e7d84845ec3444ab1845e261ef6 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;
import... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 3c4b1466866353126a86da82f390c3cd | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.*;
public class ProblemC {
static boolean ok = true;
static int count = 0;
public static void main(String[] args) throws Exception {
Scanner in = new Scanner();
StringBuilder sb = new StringBuilder();
int test = in.readInt();
while(test-->0){
int n = in.re... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | d8fd69d53a0c4754a2c6f2acf2de7daa | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
// For fast input output
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
try {
br = new BufferedReader(new FileReader("input.txt"));
PrintStr... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 55f5279790ea431bf24744b3c3760ca9 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class ComdeFormces {
static int dp[][];
static boolean mnans;
static int x[]= {-1,0,0,1,1,1,-1,-1};
static int y[]= {0,1,-1,0,1,-1,1,-1};
static int ans[];
public static void main(String[] args) throws Exception{
// TODO Auto-generated... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 2ea795335b4f404d7923bd76f546425e | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*; import java.util.*;
public class Main
{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
int t = Integer.parseInt(br.readLine());
while(t-->0){
Stri... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | e8d87baea375aaa00be7746c05a4caff | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.DataInputStream;
import java.io.IOException;
import java.util.*;
public class Yash
{
public static boolean isShaded(int i, int j, char[][] grid)
{
int n = grid.length, m = grid[0].length;
return i >= 0 && i < n && j >= 0 && j < m && grid[i][j] != '.';
}
public static boolean isL(int i... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | bcf5208be3d9a83249008c421940d4d8 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class Main {
static class Pair {
int x, y;
Pair (int x, int y) {
this.x= x;
this.y= y;
}
}
public static voi... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 1939f5320fb0244dffca7deb564647fa | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.*;
public class F {
static IOHandler sc = new IOHandler();
public static void main(String[] args) {
// TODO Auto-generated method stub
int testCases = sc.nextInt();
for (int i = 1; i <= testCases; ++i) {
solve(i);
}
}
private static void solve(i... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 3d7c73ce3015946428aae38aa5ec2e31 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
static int M = 998_244_353 ;
static Random rng = new Random();
public static boolean testCase(int n, int m, char[][] grid) {
int[][] count = new int[n][m];
int curr = 1;
for (int i = 0; i < n; i++) {
... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 1d13ce558103f493f4a4e45ad13d882f | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | // JAI SHREE RAM, HAR HAR MAHADEV, HARE KRISHNA
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.*;
import java.lang.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.io.*;
public class CodeForces {
static private final String INPUT = "input.txt";
s... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 95c7c6feb28d3c1d0ee69fe559d3ffa6 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes |
import java.io.*;
import java.lang.*;
import java.util.*;
public class F1722 {
static int[] dx;
static int[] dy;
static boolean[][] seen;
static boolean[][] arr;
static int[][] val;
public static void main(String[] args) throws IOException{
StringBuffer ans = new StringBuff... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 59b10c05752eed93a12f32f774266475 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import j... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | 0e3506ad17bc54446f201f6c285af045 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static final int ima = Integer.MAX_VALUE, imi = Integer.MIN_VALUE;
static final long lma = Long.MAX_VALUE, lmi = Long... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | f72c9b28aa37d69d015875076bbe4d19 | train_109.jsonl | 1661871000 | An L-shape is a figure on gridded paper that looks like the first four pictures below. An L-shape contains exactly three shaded cells (denoted by *), which can be rotated in any way. You are given a rectangular grid. Determine if it contains L-shapes only, where L-shapes can't touch an edge or corner. More formally: ... | 256 megabytes | import java.io.*;
import java.util.*;
public class R817F {
public static void main(String[] args) {
JS scan = new JS();
int t = scan.nextInt();
loop:while(t-->0){
int n = scan.nextInt();
int m = scan.nextInt();
char[][] board =new char[n][m];
... | Java | ["10\n\n6 10\n\n........**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n6 10\n\n....*...**\n\n.**......*\n\n..*..*....\n\n.....**...\n\n...*.....*\n\n..**....**\n\n3 3\n\n...\n\n***\n\n...\n\n4 4\n\n.*..\n\n**..\n\n..**\n\n..*.\n\n5 4\n\n.*..\n\n**..\n\n....\n\n..**\n\n..*.\n\n3 2\n\n.*\n\n*... | 1 second | ["YES\nNO\nNO\nNO\nYES\nNO\nNO\nYES\nNO\nNO"] | null | Java 11 | standard input | [
"dfs and similar",
"implementation"
] | 6a06ad39dbdd97ca8654023009c89a42 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n, m \leq 50$$$) — the number of rows and columns i... | 1,700 | For each test case, output "YES" if the grid is made up of L-shape that don't share edges or corners, and "NO" otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer). | standard output | |
PASSED | c6da341874c1c0493cf278d393b02079 | train_109.jsonl | 1629815700 | Note that the memory limit in this problem is lower than in others.You have a vertical strip with $$$n$$$ cells, numbered consecutively from $$$1$$$ to $$$n$$$ from top to bottom.You also have a token that is initially placed in cell $$$n$$$. You will move the token up until it arrives at cell $$$1$$$.Let the token be ... | 128 megabytes | import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class B {
static int mod;
static ... | Java | ["3 998244353", "5 998244353", "42 998244353", "787788 100000007"] | 6 seconds | ["5", "25", "793019428", "94810539"] | NoteIn the first test, there are three ways to move the token from cell $$$3$$$ to cell $$$1$$$ in one shift: using subtraction of $$$y = 2$$$, or using division by $$$z = 2$$$ or $$$z = 3$$$.There are also two ways to move the token from cell $$$3$$$ to cell $$$1$$$ via cell $$$2$$$: first subtract $$$y = 1$$$, and th... | Java 11 | standard input | [
"dp"
] | 77443424be253352aaf2b6c89bdd4671 | The only line contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n \le 4 \cdot 10^6$$$; $$$10^8 < m < 10^9$$$; $$$m$$$ is a prime number) — the length of the strip and the modulo. | 1,900 | Print the number of ways to move the token from cell $$$n$$$ to cell $$$1$$$, modulo $$$m$$$. | standard output | |
PASSED | 5f6a67382f27c79befc3a5e29bf09c54 | train_109.jsonl | 1629815700 | Alice and Borys are playing tennis.A tennis match consists of games. In each game, one of the players is serving and the other one is receiving.Players serve in turns: after a game where Alice is serving follows a game where Borys is serving, and vice versa.Each game ends with a victory of one of the players. If a game... | 512 megabytes | import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.min;
import static java.lang.System.exit;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public cla... | Java | ["3\n2 1\n1 1\n0 5"] | 2 seconds | ["4\n0 1 2 3\n2\n0 2\n2\n2 3"] | NoteIn the first test case, any number of breaks between $$$0$$$ and $$$3$$$ could happen during the match: Alice holds serve, Borys holds serve, Alice holds serve: $$$0$$$ breaks; Borys holds serve, Alice holds serve, Alice breaks serve: $$$1$$$ break; Borys breaks serve, Alice breaks serve, Alice holds serve: $$$... | Java 11 | standard input | [
"math"
] | 04a37e9c68761f9a2588c0bbecad2147 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). Description of the test cases follows. Each of the next $$$t$$$ lines describes one test case and contains two integers $$$a$$$ and $$$b$$$ ($$$0 \le a, b \le 10^5$$$; $$$a + b > 0$$$) — the num... | 1,300 | For each test case print two lines. In the first line, print a single integer $$$m$$$ ($$$1 \le m \le a + b + 1$$$) — the number of values of $$$k$$$ such that exactly $$$k$$$ breaks could happen during the match. In the second line, print $$$m$$$ distinct integers $$$k_1, k_2, \ldots, k_m$$$ ($$$0 \le k_1 < k_2 <... | standard output | |
PASSED | 48871a5058f896351269e3e5c8507ab2 | train_109.jsonl | 1629815700 | In a certain video game, the player controls a hero characterized by a single integer value: power.On the current level, the hero got into a system of $$$n$$$ caves numbered from $$$1$$$ to $$$n$$$, and $$$m$$$ tunnels between them. Each tunnel connects two distinct caves. Any two caves are connected with at most one t... | 512 megabytes | import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.max;
import static java.lang.System.arraycopy;
import static java.lang.System.exit;
import static java.util.Arrays.copyOf;
import static java.util.Arrays.fill;
import java.io.BufferedReader;
import java.io.IO... | Java | ["3\n4 4\n11 22 13\n8 7 5\n1 2\n2 3\n3 4\n4 1\n4 4\n11 22 13\n5 7 8\n1 2\n2 3\n3 4\n4 1\n5 7\n10 40 20 30\n7 2 10 5\n1 2\n1 5\n2 3\n2 4\n2 5\n3 4\n4 5"] | 5 seconds | ["15\n15\n19"] | NoteIn the first test case, the hero can pass the level with initial power $$$15$$$ as follows: move from cave $$$1$$$ to cave $$$2$$$: since $$$15 > 11$$$, the hero beats the monster, and his power increases to $$$15 + 8 = 23$$$; move from cave $$$2$$$ to cave $$$3$$$: since $$$23 > 22$$$, the hero beats the ... | Java 11 | standard input | [
"graphs"
] | 787ad7de581891696681fbc19cd7116a | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$3 \le n \le 1000$$$; $$$n \le m \le min(\frac{n(n-1)}{2}, 2000)$$$) — the number... | 3,000 | For each test case print a single integer — the smallest possible power the hero must start the level with to be able to beat all the monsters and pass the level. | standard output | |
PASSED | 4cf22d36d1a61c222a3c41e96850b9e7 | train_109.jsonl | 1629815700 | Consider the insertion sort algorithm used to sort an integer sequence $$$[a_1, a_2, \ldots, a_n]$$$ of length $$$n$$$ in non-decreasing order.For each $$$i$$$ in order from $$$2$$$ to $$$n$$$, do the following. If $$$a_i \ge a_{i-1}$$$, do nothing and move on to the next value of $$$i$$$. Otherwise, find the smallest ... | 512 megabytes | import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.System.exit;
import static java.util.Arrays.fill;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
im... | Java | ["3\n3 0\n3 2\n2 1\n3 1\n5 3\n3 1\n4 1\n5 3"] | 3 seconds | ["10\n1\n21"] | NoteIn the first test case, the algorithm performs no insertions — therefore, the initial sequence is already sorted in non-decreasing order. There are $$$10$$$ such sequences: $$$[1, 1, 1], [1, 1, 2], [1, 1, 3], [1, 2, 2], [1, 2, 3], [1, 3, 3], [2, 2, 2], [2, 2, 3], [2, 3, 3], [3, 3, 3]$$$.In the second test case, the... | Java 11 | standard input | [
"combinatorics"
] | 45da2b93570e7d26d0e4fd3a3fca20b7 | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^5$$$). Description of the test cases follows. The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n \le 2 \cdot 10^5$$$; $$$0 \le m < n$$$) — the length of the sequence... | 2,600 | For each test case, print the number of sequences of length $$$n$$$ consisting of integers from $$$1$$$ to $$$n$$$ such that sorting them with the described algorithm produces the given sequence of insertions, modulo $$$998\,244\,353$$$. | standard output | |
PASSED | 2765d39d738dcd3b7706560a92d4ac7b | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.*;
public class NotShading{
public static void main(String args[]){
Scanner s=new Scanner(System.in);
int test=s.nextInt();
for(int k=0;k<test;k++){
int n=s.nextInt();
int m=s.nextInt();
int r=s.nextInt();
int c=s.nextInt();
boolean case1=false;
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 30be744c3a7c3bcfa7b201a2470d8f4d | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes |
import java.util.*;
import java.lang.*;
/* Name of the class has to be "Main" only if the class is public. */
public class S1 {
public static void main(String[] args) throws java.lang.Exception {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t--!=0){
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | ff955064a3b418f82d75055a5205f70a | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.StringTokenizer;
public class Solution implements Runnable {
BufferedReader in;
PrintWriter out;
Str... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | f72a2d0d3be51bf88273beb8eaf8b98c | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Chill800 {
static BufferedReader br;
static StringTokenizer st;
static PrintWriter pw;
static String nextToken() {
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | c0440a45a77bc1e2e511bd4a0c768e60 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.Scanner;
public class A_Not_Shading{
static Scanner in=new Scanner(System.in);
static int n,m,r,c,testCases;
static char a[][];
static void solve(){
int white=0,black=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(a[i][c-1]=='B' || a[r-1][j]==... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | e40eb0571bbb272f22d1f69a04188cdf | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class MacroTemplates
{
public static void main(String hi[]) throws Exception
{
BufferedR... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 3501452937e9c4ee2c05c690c39d8c37 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.*;
import java.io.*;
//import static com.sun.tools.javac.jvm.ByteCodes.swap;
// ?)(?
public class fastTemp {
static class Node
{
int data;
Node left, right;
Node(int data)
{
this.data=data;
left=right=null;
}
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | a93bb283bfcb2cf9a40d3479bf8669a7 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.*;
public class A {
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 r = sc.nextInt();
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | a7766748ea581808406b114676077be3 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.lang.*;
import java.io.*;
import java.util.*;
public class NotShading {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
try {
br = new BufferedReader(
new FileReader("input.txt... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | c5aff7718cd08ce99724d6439e09f2cb | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.io.*;
public class NotShading
{
public static void main(String[] args) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int tc = Integer.parseInt(in.readLine());
for(int x=0; x<tc; x++)
{
String ip[] = new String[1];
ip = in.r... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 726316a63eac2af2cb4b0082f7eed444 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
int x=scanner.nextInt();
int[] re=new int[x];
for (int i = 0; i < x; i++) {
int status=2;
int flag=0;
int a=scanner.next... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | a4390ff4bf2ef13d74f3c9808b7659d3 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class Main
{
public static void main(String args[])throws IOException {
// System.setIn(new FileInputStream("Case.txt"));
BufferedReader ob = new BufferedReader(new InputStreamReader(System.in)... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | a4704b088eac1e32f405bd0440ab27ca | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.*;
public class A{
static Scanner sc;
public static void solve(){
int n=sc.nextInt();
int m=sc.nextInt();
int r=sc.nextInt();
int c=sc.nextInt();
char a[][]=new char[n][m];
int b=0;
for(int i=0;i<n;i++){
String s=sc.next();
for(int j=0;j<s.length();j++){
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | a2d94648e4ae8d26d9eba57b3b079db7 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Codechef {
static class FR{
BufferedReader br;
StringTokenizer st;
public FR() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.ha... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | e72fecc7abe280b2d185111349993099 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t=scan.nextInt();
int map[][] = new int[55][55];
for(int i = 0;i<t;i++){
int flag=0;
int n=scan.nextInt();
in... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 0cea30507c17baa3fbd7e73e74bca612 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.Scanner;
public class A_Not_Shading {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int t = scn.nextInt();
while(t-->0){
int n = scn.nextInt();
int m = scn.nextInt();
int r = scn.nextInt();
int... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 93df01b7c49f63f6735628b3e51195de | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 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 Main
{
public static void main (String[] args) throws java.lang.Exception
{
in = new FastReader();
o... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 028258cabd95f67148c449c8cd987feb | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | /******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.
***********************************************... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | d6564b93d7aae971fdfb5f292c7d08ad | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.*;
public class A_Not_Shading {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int m=sc.nextInt();
int n=sc.nextInt();
int r=sc.nextInt();
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | b2e78c68233136ff7ae437b0f63a2b0c | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 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 n = sc.nextInt(), m = sc.nextInt(), r = sc.nextInt(), c = sc.nextInt();
sc.nextLine();
St... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 7e61ee96c36100ac51866928d4f34f19 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class test {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(Sys... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | f35043cf31eb0812e53c8779824b709e | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/**
* https://codeforces.com/problemset/problem/1627/A
* @author ey
*
*/
public class P1627A {
public static void main(String[] args) throws IOExceptio... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 6560507858e868c04cde5b51fc29e758 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int m = sc.nextInt();
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 78c1464c09690917aa12763d35a105fe | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
int T = in.nextInt();
for (int tt = 0; tt < T; tt++) {
in... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 9ee5e3010dde9c77b712e9e5e29661bb | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
int T = in.nextInt();
for (int tt = 0; tt < T; tt++) {
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | cee5c86975494b060b1ee2d811eaa924 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.lang.*;
import java.util.*;
import java.io.*;
public class class5 {
public static void main(String[] arg){
Scanner s=new Scanner(System.in);
try {
int t=s.nextInt();
while(t-->0){
int n=s.nextInt();
int m=s.nextInt();
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | f94f627f4101be8386d3374e2eb49ffe | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class A_Not_Shading {
public static void main(String[] arg){
Scanner s=new Scanner(System.in);
try {
int t=s.nextInt();
while(t-->0){
int n=s.nextInt();
int m=s.nextInt(... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | a94dded7893e4c3b84b2eaeb44138b08 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public final class Main
{
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 | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 518e1e4f78f5b256eea34e4b1cc0e36f | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int Count = sc.nextInt();
for(int count=0;count<Count;count++){
int N = sc.nextInt(), M = sc.nextInt();... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 6a78f4c1997b3b581de0c31fc8c7e45e | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.Scanner;
public class NotShading{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int cases= sc.nextInt();
for(int x=0; x< cases; x++)
{
int rows= sc.nextInt();
int cols= sc.nextInt();
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | b040044b31374e4baedf1a12b0414a41 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
for (int i = 0; i < t; i++) {
notShading(scanner);
}
}
private static void notShading(Scanner scanner) {
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | c6da9da5cd1d3d80501010e58ac3234a | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
//@Manan Parmar
public class Solution2 implements Runnable {
public void run() {
InputReader sc = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out)... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | b8057b003dcabc05114287c06b3c65f9 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | // Working program using Reader Class
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.StringTokenizer;
public class Main {
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
pr... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | d88dc4e7facf813497c678a39091881c | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | //package codeforces_464_div2;
import java.util.Scanner;
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();
int r ... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 8c01e912e14b867fb0ef3b90f58f5a56 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | //package p1627;
import java.util.Arrays;
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int x = 0; x < t; x++) {
int n = sc.nextInt();
int m = sc.nextInt();
int r = sc.nex... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | 58516cd38125566562f4b5bd0f6ff016 | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class NotShading {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t-- > 0) {
int n = s.nextInt();
int m = s.nextInt();
int r = s.nex... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output | |
PASSED | c080ee2c88b4a513aea8ae38dd8c229c | train_109.jsonl | 1642257300 | There is a grid with $$$n$$$ rows and $$$m$$$ columns. Some cells are colored black, and the rest of the cells are colored white.In one operation, you can select some black cell and do exactly one of the following: color all cells in its row black, or color all cells in its column black. You are given two integers $... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int t = Integer.parseInt(in.nextLine());
StringBuilder ans = new StringBuilder("");
while(t-- > 0){
String[] s = in.nextLine().split(" ");
... | Java | ["9\n\n3 5 1 4\n\nWBWWW\n\nBBBWB\n\nWWBBB\n\n4 3 2 1\n\nBWW\n\nBBW\n\nWBB\n\nWWB\n\n2 3 2 2\n\nWWW\n\nWWW\n\n2 2 1 1\n\nWW\n\nWB\n\n5 9 5 9\n\nWWWWWWWWW\n\nWBWBWBBBW\n\nWBBBWWBWW\n\nWBWBWBBBW\n\nWWWWWWWWW\n\n1 1 1 1\n\nB\n\n1 1 1 1\n\nW\n\n1 2 1 1\n\nWB\n\n2 1 1 1\n\nW\n\nB"] | 1 second | ["1\n0\n-1\n2\n2\n0\n-1\n1\n1"] | NoteThe first test case is pictured below. We can take the black cell in row $$$1$$$ and column $$$2$$$, and make all cells in its row black. Therefore, the cell in row $$$1$$$ and column $$$4$$$ will become black. In the second test case, the cell in row $$$2$$$ and column $$$1$$$ is already black.In the third test ... | Java 8 | standard input | [
"constructive algorithms",
"implementation"
] | 4ca13794471831953f2737ca9d4ba853 | The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains four integers $$$n$$$, $$$m$$$, $$$r$$$, and $$$c$$$ ($$$1 \leq n, m \leq 50$$$; $$$1 \leq r \l... | 800 | For each test case, if it is impossible to make the cell in row $$$r$$$ and column $$$c$$$ black, output $$$-1$$$. Otherwise, output a single integer — the minimum number of operations required to make the cell in row $$$r$$$ and column $$$c$$$ black. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.