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
7df1d5b1dfd7c9dc4462e45586c8e481
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author dipankar12 */ import java.io.*; import java.util.*; public class r291c { static boolean found=false; r291c1...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
0f4837fc0001470e4561900fce9e83a6
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author dipankar12 */ import java.io.*; import java.util.*; public class r291c { static boolean found=false; r291c1...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
016f2c5a6ad88c049ec64bb84ed6bc84
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author dipankar12 */ import java.io.*; import java.util.*; public class r291c { static boolean found=false; r291c1...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
522d8c3f130943f68b76ac08641f1820
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author dipankar12 */ import java.io.*; import java.util.*; public class r291c { static boolean found=false; r291c1...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
021cde278e2beed7a55157a779a82f65
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.*; import java.util.*; public class icpc { public static void main(String[] args) throws IOException { // Reader in = new Reader(); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String s1[] = i...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
d4e5f5c13c87b86cbd0bf3ded48b592d
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class WattoAndMechanism implements Closeable { pri...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
9e336ed58d5279bc9bed59ae338815d3
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; public class WattoAndMechanism implements Closeable { pr...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
f4962c0e3b85e150f77b3003796cbbbd
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.util.*; import java.io.*; public class WattoandMechanism { /************************ SOLUTION STARTS HERE ***********************/ private static long x = 31; private static long mod = (long)(1e9) + 7L; // Default static final class ModMath { static long sub(long a,long b) { ...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
c92e8a42375ad2b3329441b332c66867
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.util.*; import java.io.*; public class WattoandMechanism { /************************ SOLUTION STARTS HERE ***********************/ private static long x = 273; static final class ModMath { private static long mod = 9576890767L; // Random 10 digit prime static long sub(long a,long ...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
e858815ed5b902ce0388b3696d63aa7c
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.util.*; import java.io.*; public class WattoandMechanism { /************************ SOLUTION STARTS HERE ***********************/ private static long x1 = 73; private static long x2 = 17; static class Pair { long hash1,hash2; Pair(long h1,long h2) { hash1 = h1; hash2 = h...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
58751725faa071d0e9e6c89ab615270a
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.util.*; import java.io.*; public class WattoandMechanism { /************************ SOLUTION STARTS HERE ***********************/ private static long x = 73; static final class ModMath { private static long mod = (long)(1e9) + 7L; // Default static long sub(long a,long b) { l...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
1b7b13d44d95b77886854b1ab7781d7f
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.util.*; import java.io.*; public class WattoandMechanism { /************************ SOLUTION STARTS HERE ***********************/ private static long x = 73; static final class ModMath { private static long mod = (long)(1e9) + 7L; // Default static long sub(long a,long b) { l...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
df6d0b7baad11ebbd4e8804cb1ec5b92
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.util.*; import java.io.*; public class WattoandMechanism { /************************ SOLUTION STARTS HERE ***********************/ private static long x1 = 273; private static long x2 = 31; static class Pair { long hash1,hash2; Pair(long h1,long h2) { hash1 = h1; hash2 = ...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
f9e917cf956f1b611b3067d0e1a26cc8
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.util.*; import java.io.*; public class WattoandMechanism { /************************ SOLUTION STARTS HERE ***********************/ private static long x1 = 73; private static long x2 = 17; static class Pair { long hash1,hash2; Pair(long h1,long h2) { hash1 = h1; hash2 = h...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
4d333c418c667ef8f3c913fc4a850ad7
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.util.*; import java.io.*; public class WattoandMechanism { /************************ SOLUTION STARTS HERE ***********************/ private static long x1 = 273; private static long x2 = 31; static class Pair { long hash1,hash2; Pair(long h1,long h2) { hash1 = h1; hash2 = ...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
a6c45a136aebbc526d9b3f582fa1ea95
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.awt.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class CandidateCode { static long mod = 1000000007,mod1=1000000207; public static void main(String[] args) throws IOException { FastReader sc = new FastReader(); ...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
1bb4ca82cb51d4dbe56a7e365aa17521
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.util.HashSet; import java.util.Scanner; public class Watto_and_mechanism { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int m = scn.nextInt(); StringBuilder sb = new StringBuilder(); HashSet<Long> st = new HashSet<>(); String[] ars = ne...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
d71575f3a6f6292155c1786e89315c6d
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.Arrays; public class WattoAndMechanism { private WattoAndMechanism() throws IOException { BufferedReader br = new BufferedReader(new InputSt...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
a74d40be6195d7ec68865ca151213a0f
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.StringTokenizer; import java.util.Set; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /**...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
17309070a4011896bbd771094d0b04e4
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Set; import java.util.StringTokenizer; /* public class _514C_3 { } */ public class _514C_3 { long prime = 5;...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
d32cd655f2ff25ab53beaf3b6db54c51
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; /** * Created by Xinyu Zhao on 11/10/2017. */ public class WattoAndMechanism { public static void main(String[] args) throws IOException { BufferedReade...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
e25e68eacffb9208438a0341e2f3cafa
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; public class Round291C { public static class trie{ trie[] map; boolean eow; public trie() { map=...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
8f3d43aaefbf9db7f3e45319faefe902
train_003.jsonl
1423931400
Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the mechanism should be able to process queries of the following type: "Given string s, determine if the memory of the mech...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; public class CF291C { static M...
Java
["2 3\naaaaa\nacacaca\naabaa\nccacacc\ncaaac"]
3 seconds
["YES\nNO\nNO"]
null
Java 8
standard input
[ "hashing", "string suffix structures", "data structures", "binary search", "strings" ]
146c856f8de005fe280e87f67833c063
The first line contains two non-negative numbers n and m (0 ≤ n ≤ 3·105, 0 ≤ m ≤ 3·105) — the number of the initial strings and the number of queries, respectively. Next follow n non-empty strings that are uploaded to the memory of the mechanism. Next follow m non-empty strings that are the queries to the mechanism. Th...
2,000
For each query print on a single line "YES" (without the quotes), if the memory of the mechanism contains the required string, otherwise print "NO" (without the quotes).
standard output
PASSED
a1587b3a6177ec9afca89e469b0425f5
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigI...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
7aa7878e8b88678439121c8e864a18a4
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); StringTokenizer tk; int n = toInt(in.read...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
3064b9caa010d5ed024462adff18b598
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.TreeSet; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Popa Andrei */ public class Main {...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
aa904534b6eb051627504dc9d38f1577
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws Exception { int n1 = Integer.parseInt(in.readLine()); int [] l1...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
598bcb7de700b785f2f341d04ceec28a
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.util.*; import java.io.*; public class Main implements Runnable { class Ball implements Comparable<Ball>{ int size; int cnt; Ball(int b, int cnt){ this.size = b; this.cnt = cnt;} publi...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
779a105085ad9c84ebb847d2d17c3540
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.PriorityQueue; import java.util.Queue; import javax.swing.plaf.metal.OceanTheme; public class NewYearS...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
51ddc676f066b006322ca3ee06d7b6ac
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.util.Map; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.PriorityQueue; import java.util.InputMismatchException; import java.util.HashMap; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWr...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
bf75e712fbcbac7a9f1617758012c973
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Solution { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine().trim()); ...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
b7697ac738d17f51eb113c483dfe1b06
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.util.Arrays; import java.util.Collections; import java.util.Scanner; import java.util.Map; import java.util.HashMap; import java.util.List; import java.util.LinkedList; import java.util.*; public class TascC2 { public static class Pair implements Comparable<Pair> { int r; int n; public int comp...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
09f0438f8f1d5c8308bfe7ce6ea5f2e0
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.PriorityQueue; import java.util.Scanner; public class Main{ private class Element implements Comparable<Element>{ private int value; private int occ; public Element(int a, int ...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
63fe039c70029c630dc32376c8dd6240
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
/* ID: nikchee1 PROB: Snowmen LANG: JAVA */ import java.io.*; import java.util.*; public class Main{ static Scanner in = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); static int N = in.nextInt(); static TreeMap<Integer, Integer> prq = new TreeMap<Integer, Integer>(); public...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
c66d0c5ad713757f9207f024793fd2ee
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.PriorityQueue; import java.util.StringTokenizer; /* * To change this template, choose Tools | Templates * and open the template...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
e9543f963049caeedb3a05f5eddc1f4a
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.util.*; public class CF140C { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); HashMap<Integer, Integer> f = new HashMap<Integer, Integer>(); for(int i = 0; i < n; i ++) { int a = in.nextInt(); if(!f.containsKey(a)) f.put(a, 0); f.pu...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
02c79c0796a18e0ae23b4f02cbbae3ab
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.io.*; import java.util.*; public class Pr402C { public static void main(String[] args) throws IOException { new Pr402C().run(); } BufferedReader in; PrintWriter out; StringTokenizer st; String nextToken() throws IOException { while (st == null || !st.hasMoreTokens()) { st = new StringTokeniz...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
2f05aefeae779e5d8738ce05e3dbd8e2
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.System.*; import static java.lang.Integer.*; public class CF140C{ public static void main(String[] args)throws Exception{ BufferedReader sc = new BufferedReader(new InputStreamReader(in)); int n = parseInt(sc.readLine()); ...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
9d0075f71dc02eadf6ac46878dd7737d
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.InputMismatchException; import java.util.List; import java.util.Map; import java.util.PriorityQueue; import java.util.Queue; public class P...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
08cec25e54147d9f138ad454bf5284e9
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.io.*; import java.util.*; public class test { public static void main(String[] args) { new test().run(); } void run() { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); TreeMap<Integer, Integer> tm = new TreeMap<Integer, Integer>(); int n = in.nextInt()...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
8d3527255d268bf15c92590cd2072eb5
train_003.jsonl
1325689200
As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made n snowballs with radii equal to r1, r2, ..., rn. To make a snowman, one needs any thr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.Map; import java.util.PriorityQueue; import java.util.Queue; import java.util.StringTokenizer; public...
Java
["7\n1 2 3 4 5 6 7", "3\n2 2 3"]
2 seconds
["2\n3 2 1\n6 5 4", "0"]
null
Java 7
standard input
[ "data structures", "binary search", "greedy" ]
551e66a4b3da71682652d84313adb8ab
The first line contains integer n (1 ≤ n ≤ 105) — the number of snowballs. The next line contains n integers — the balls' radii r1, r2, ..., rn (1 ≤ ri ≤ 109). The balls' radii can coincide.
1,800
Print on the first line a single number k — the maximum number of the snowmen. Next k lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the...
standard output
PASSED
b73887a0a0def0b01dd9c66c0045f2f5
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.io. *; import java.util.*; import static java.lang.Math.*; public class Main { static final FastReader sc = new FastReader(System.in); static final PrintWriter pw = new PrintWriter(System.out); static int visited[]; static ArrayList<ArrayList<Integer>> adjlist; static class edge implem...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
ad1d51f419cf376070db039c2b5079c9
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.util.*; import java.io.*; public class MainClass { public static void main(String[] args)throws IOException { // Reader in = new Reader(); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(in.readLine()); StringBuilder s...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
33a7a3a21a13d8b6ad32342abe8cb399
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.*; import java.util.stream.IntStream; public class C { public static void main(String[] args) throws IOException { Scanner in = new Scanner(new BufferedInputStr...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
8282f628fafae4859cec8c051a5dbed1
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.util.Scanner; /** * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools */ public class Main { public static void main(String[] args) { // Write your solution here Scanner scanner = new Scanner(System.in); int t = Integer.parseInt(...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
a556238dc0a6984c5460da0d195d9eb6
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
//@author->.....future_me......// //..............Learning.........// import java.util.*; import java.io.*; import java.lang.*; import java.math.BigInteger; public class B { // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Fast IO <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // static class FastReader { BufferedReader br; Str...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
e9d756a538f0fd77d83903d29c76135e
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
//@author->.....future_me......// //..............Learning.........// import java.util.*; import java.io.*; import java.lang.*; import java.math.BigInteger; public class B { // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Fast IO <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // static class FastReader { BufferedReader br; Str...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
2f4ffc62cbb33a44f3bd846ffc53c029
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
// No sorcery shall prevail. // import java.util.*; import java.io.*; public class InVoker { //Variables static long mod = 1000000007; static long mod2 = 998244353; static FastReader inp= new FastReader(); static PrintWriter out= new PrintWriter(System.out); public static void main(String args[]) { ...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
40d5ee520e9a11a3b0633361554d5337
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class Solutions { private final static class FastScanner { BufferedReader br = new BufferedReader(new InputStreamReader(System...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
ff8c36a3aa22ac6e89f528b071e9980c
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Prison { public static void main(String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); while (t...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
597d7e81cbd1103e9c93dc20327c3eb6
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br; static PrintWriter out; static StringBuilder res = new StringBuilder(); static final int mod = 1000000007; static ArrayList<Integer> primes = new ArrayList<>(); static long start,time; public static void ma...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
5636b27705372399a7510b9179bf22d0
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) throws IOException, InterruptedException { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextIn...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
08ae86c0e8a84ad7d9b8e8746db7e41b
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.util.*; import java.io.*; import java.awt.*; public class BouncingBall { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(S...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
bc6fe27e5bdddeac16eb28451e722bd8
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int tc = input.nextInt(); while(tc-->0) { int n = input.nextInt...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
49ebc5f102df88f213932936081969c7
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.util.stream.Collectors; public class Main { static FastScanner sc; static PrintWriter pw; static final long INF = 1000000150l; public static Integer cycle_end, cycle_st; public static int[] p; public static int[...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
c481f5548ced3b5e549efa068e2c793c
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.util.stream.Collectors; public class Main { static FastScanner sc; static PrintWriter pw; static final long INF = 10000000000l; public static Integer cycle_end, cycle_st; public static int[] p; public static int...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
064686e09f2ccef489c14a5d3994c182
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.function.*; import java.util.regex.*; import java.util.stream.*; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; pu...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
0a785d4ebc1fa888703df6473c7a969e
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.util.*; import java.util.concurrent.LinkedBlockingDeque; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; // graph, dfs,bfs, get connected components,iscycle, isbip...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
e20eab00ff8ffa6d0c226f77d548a0f7
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { FastReader in = new FastReader(System....
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
d3adef6714edd8dfcad88314c85f4ca0
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
//package j.gym.codeforces.regular.r68x.r687; import java.io.*; import java.util.*; public class R687Div2C { public void solve(InputProvider in, PrintWriter out) throws IOException { int testCount = in.nextInt(); for (int test = 0; test < testCount; test++) { int pointCount = in.nextI...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
b2250904fcea7d796aa9f778d92f2ad0
train_003.jsonl
1606633500
You're creating a game level for some mobile game. The level should contain some number of cells aligned in a row from left to right and numbered with consecutive integers starting from $$$1$$$, and in each cell you can either put a platform or leave it empty.In order to pass a level, a player must throw a ball from th...
256 megabytes
import java.io.*; import java.util.*; public class C { public static void main(String[] args) { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); while(t-->0) { int n = in.nextInt(), p = in.nextInt()-1, k = in.nextInt();...
Java
["3\n10 3 2\n0101010101\n2 2\n5 4 1\n00000\n2 10\n11 2 3\n10110011000\n4 3"]
1 second
["2\n4\n10"]
NoteIn the first test case it's best to just remove the first cell, after that all required platforms are in their places: 0101010101. The stroked out digit is removed, the bold ones are where platforms should be located. The time required is $$$y = 2$$$.In the second test case it's best to add a platform to both cells...
Java 8
standard input
[ "dp", "implementation" ]
112a0cac4e1365c854bb651d3ee38df9
The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). Description of test cases follows. The first line of each test case contains three integers $$$n$$$, $$$p$$$, and $$$k$$$ ($$$1 \le p \le n \le 10^5$$$, $$$1 \le k \le n$$$) — the number of cells you have, the first cell that should conta...
null
For each test case output a single integer — the minimum number of seconds you need to modify the level accordingly. It can be shown that it is always possible to make the level passable.
standard output
PASSED
87ac5998034474be9703ae01bfb1fe54
train_003.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class b { public static PrintWriter out; public static FS sc; p...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
07717c073576c97b272c9fbcb1f8880a
train_003.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.*; import java.util.*; public class AverageSuperpower { public static void main(String[] args) throws Exception{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(f.readLine()); int n = Integer.parseInt(st.nextToken()); long k ...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
c88b04d3fc4c7616b187124ce80a2937
train_003.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.*; public class a{ public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int k=in.nextInt(); int m=in.nextInt(); Long[] ar=new Long[n]; double sum2=0; for(int i=0;i<ar.length;i++){ ar[i]...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
87d946a181cfdddedf68123499bac4e6
train_003.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.*; public class B1111 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int m = scanner.nextInt(); List<Integer> aArr = new ArrayList<>(); //求总和 long s...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
859a5f3635df5eb49462921fb1c95188
train_003.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
/* MOHD SADIQ mohdsadiq058 */ import java.util.*; import java.io.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.ArrayList; public class Main { private static BufferedReader br = new BufferedReader(new InputStrea...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
1c7985b44b7d9a8f24ab47fb59a87100
train_003.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.*; import java.util.*; public class B { static StringBuilder st = new StringBuilder(); public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in) ; PrintWriter out = new PrintWriter(System.out) ; int n = sc.nextInt() ; long k = sc.nextInt() , m = s...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
cd67ec52fa52cb47d43c969df0169b30
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.util.Scanner; public class SumOfOddIntegers { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while(T-->0){ long n = sc.nextLong(); long k = sc.nextLong(); if(((n%2)==(k...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
79b275483384f334557e8abfba08337c
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.util.Scanner; public class SumOfOddIntegers { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while(T-->0){ long n = sc.nextLong(); long k = sc.nextLong(); if(((n%2)==(k%2))...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
d829530798b554f86bb15285f871eb05
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.util.Scanner; public class SumOfOddIntegers { public static String isSumOfOddNumbers(long n, long k){ if(n < k*k) return "NO"; if(n%2 == 0 && k%2 != 0) return "NO"; else if (n%2 != 0 && k%2 == 0 ) return "NO"; return "YES"; } public static void main(String[] args){ Sc...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
173b532c9849d8e9a96040f495358849
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader b1 = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(b1.readLine()); o: while(t-->0) { String [] vals = (b1.readLine()).split(" "); ...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
d1f06d4048040fc684db074420cf8f96
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public ...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
15e7947350634a4cfddef848f2ac5f26
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
// package codeforces.educational_84; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; /** * Created by Krishna Kota */ public class Main { p...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
55ae7333700d952f2d01c01279ec2ca7
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.util.*; public class OddIntegers { public static void main(String[] args) { Scanner in = new Scanner(System.in); int count = in.nextInt(); for (int j = 0; j < count; j++) { long n = in.nextInt(); long k = in.nextInt(); if (n >= k * k && n % 2 =...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
245dafc1aec2d7326d0cd303da495cb6
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.util.*; public class OddIntegers { public static void main(String[] args) { Scanner in = new Scanner(System.in); int count = in.nextInt(); for (int j = 0; j < count; j++) { long n = in.nextInt(); long k = in.nextInt(); if (n < k * k) { ...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
30b7ef9d9055c12438382788af5087e1
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class First { public static void main(final String args[]) { int t; Scanner in = new Scanner(System.in); t = in.nextInt(); long n, k; for (int i = 1; i <= t; i++) { n = in.nextInt(); k =...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
af20a7e3b87d67ff9fc4ddb8b31bc5f7
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class First { public static void main(final String args[]) { int t; Scanner in = new Scanner(System.in); t = in.nextInt(); long n, k; for (int i = 1; i <= t; i++) { n = in.nextInt(); k ...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
e112ac9b95c0af52dec31dd94744d5b5
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.util.*; public class JavaApplication { public static void main(String[] args) { Scanner in=new Scanner(System.in); int t=in.nextInt(); for(int j=0;j<t;j++){ int n=in.nextInt(),k=in.nextInt(); if (n % 2 == k % 2 && (long) k * k <= n) { System.out.println("...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
2995f18ddbee0bf5e85a445db4571a21
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws NumberFormatException, IOException { Scanner sc = new Scanner(System.i...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
faa54250213407c0de8f033785b7ed3f
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws NumberFormatException, IOException { Scanner sc = new Scanner(System.i...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
763df15442493dcd26720ef21615d78e
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.util.*; import java.util.ArrayList; public class Main{ public static void main(String[] args){ Scanner param = new Scanner(System.in); int end=param.nextInt(); while(end-->0){ int n=param.nextInt(); int m=param.nextInt(); if(Math.sqrt(n)<m) { ...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
866915c5eeb0f4b71d549155b0494c92
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.util.Scanner; public class oddinteger { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int n,k; for(int i = 0 ; i < t ; i++){ n = sc.nextInt(); k = sc.nextInt(); // boolean b = n >= ...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
2a6430b49f9e8923f5860c0035127296
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
// package EducationalRound84; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class ProblemA { public static void main(String[] args)throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
0f0f4c8a1a697415ccd1c7ae29b6ec09
train_003.jsonl
1584974100
You are given two integers $$$n$$$ and $$$k$$$. Your task is to find if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers or not.You have to answer $$$t$$$ independent test cases.
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int...
Java
["6\n3 1\n4 2\n10 3\n10 2\n16 4\n16 5"]
2 seconds
["YES\nYES\nNO\nYES\nYES\nNO"]
NoteIn the first test case, you can represent $$$3$$$ as $$$3$$$.In the second test case, the only way to represent $$$4$$$ is $$$1+3$$$.In the third test case, you cannot represent $$$10$$$ as the sum of three distinct positive odd integers.In the fourth test case, you can represent $$$10$$$ as $$$3+7$$$, for example....
Java 8
standard input
[ "math" ]
a4c82fffb31bc7e42870fd84e043e815
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. The only line of the test case contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n, k \le 10^7$$$).
1,100
For each test case, print the answer — "YES" (without quotes) if $$$n$$$ can be represented as a sum of $$$k$$$ distinct positive odd (not divisible by $$$2$$$) integers and "NO" otherwise.
standard output
PASSED
e1d56e4955d99f0cea49e8a4f4c6eebc
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class DIV2423B { public static PrintWriter out; //-----------MyScanner class for faster input---------- public static class MyScanner { ...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
12a07f58de01691a88f1347e87f8db32
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
//package TIM2; import java.io.*; import java.util.*; public class Main { static Scanner input = new Scanner(System.in); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pw = new PrintWriter(System.out); static int mod; public static void main(S...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
6aece70aeba2954326b03ebd17c6f65a
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
94bcce7eda6b68f52a6ef52306b8c2f0
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
94be52eaff1807c693ad53dc4c573528
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class B { public static void main(String[] args) { FastScanner scan = new FastScanner(); PrintWriter out = new PrintWriter(Sy...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
78715bd6e7e989db4e00a956c9d6129d
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class BlackSquare { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str1[] = br.readLine().split(" "); int row = Integer.parseInt(str1[0]); int colu...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
d3744d1e20378f5777f9336fa60d263c
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author captainTurtle */ public class Main { public static void main(Stri...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
b1b3a9f1da27d8122436933361653fe0
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author captainTurtle */ public class Main { public static void main(Stri...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
8c929d4eddd50546ee9834c298a86efe
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.util.Scanner; public class BlackSquare { public static void main(String[] args) { // TODO Auto-generated method stub int m,n,bs=0; Scanner in = new Scanner(System.in); m = in.nextInt(); n = in.nextInt(); char [][]a = new char [m][n]; int []LFB = new int [m]; int []LLB = new int [m]; in...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
c674fecb0cee9689cc64633d307b8f9b
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.Input...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
d127a777c84216f84c17b4088601b501
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class B_423_1 { InputStream is; PrintWriter out; int n; long a[]; private boolean oj = System.getProperty("ONLINE_JUDGE") !=...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
084e1df7045b086ee60b01f6345d345b
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int m = Integer.parse...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
4be130f28100d01334d568e3705ec3d3
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.*; import java.util.*; public class BB { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int m = Integer.parse...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
ece9f79a3c95d9d3c359d94a9356377c
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; @SuppressWarnings("unchecked") public class P828B { public void run() throws Exception { int n = nextInt(), m = nextInt(), t = 0; int [][] f = new int [n + 1][m + 1]; for (int i = 1; i <= n; i++) { String s = next...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
d8dd2d4978106de94edaf408ed9d8880
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.util.*; public class black { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); int mini=n,maxi=0,minj=m,maxj=0,b=0; for(int i=0;i<n;i++) { String s=sc.next(); for(int j=0;j<m;j++) { char ch=s.charAt(j); if...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output
PASSED
4877bd31eafa1619c726c7d792ab8d5b
train_003.jsonl
1499791500
Polycarp has a checkered sheet of paper of size n × m. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of white cells with black so that all black cells form a square.You are to determine the minimum possible nu...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; Outpu...
Java
["5 4\nWWWW\nWWWB\nWWWB\nWWBB\nWWWW", "1 2\nBB", "3 3\nWWW\nWWW\nWWW"]
1 second
["5", "-1", "1"]
NoteIn the first example it is needed to paint 5 cells — (2, 2), (2, 3), (3, 2), (3, 3) and (4, 2). Then there will be a square with side equal to three, and the upper left corner in (2, 2).In the second example all the cells are painted black and form a rectangle, so it's impossible to get a square.In the third exampl...
Java 8
standard input
[ "implementation" ]
cd6bc23ea61c43b38c537f9e04ad11a6
The first line contains two integers n and m (1 ≤ n, m ≤ 100) — the sizes of the sheet. The next n lines contain m letters 'B' or 'W' each — the description of initial cells' colors. If a letter is 'B', then the corresponding cell is painted black, otherwise it is painted white.
1,300
Print the minimum number of cells needed to be painted black so that the black cells form a black square with sides parallel to the painting's sides. All the cells that do not belong to the square should be white. If it is impossible, print -1.
standard output