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
ab84dece90029fb12dc1c750adb5a979
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.HashMap; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelpe...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
48e77ef3b966b8bf2a036c667a52ddf4
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.util.HashMap; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; ...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
bd5dba8372d41c05d56166bd70abfe69
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
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.*; public class C { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter out =...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
9d22a7a25afa560b1b631f303c8df7e9
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in))); public static void main(String[] args) { int k = input.nextInt(); int n = input.nextInt(); Set<Integer> a = new HashS...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
4ce5d891cd58e9f80282049f7a84d80f
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; /** * Created by aps36017 on 14/7/17. */ public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
30239f4df0c96f7e34054415081d2c1e
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; /** * Created by aps36017 on 14/7/17. */ public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
9ed068a8f8296d81a49bd720ce8c04d6
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class JuryMarks { public static void main(String[] args) { try(Scanner sc = new Scanner(System.in)) { int k = sc.nextInt(); int n = sc.nextInt(); int[] ka = new int[k]; int[] su...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
01a7da4d4095acbf7067661568b81836
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.AbstractMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Comp...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
5866e1bf5b756958bb0f554931c3c5a6
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.*; import java.util.*; import java.util.InputMismatchException; import java.util.List; /** * http://codeforces.com/contest/831/problem/C */ public class JuryMarks { InputStream is; PrintWriter out; ...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
f7a0b0cb4c6ec129fcde43f2753807b1
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
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.Arrays; import java.util.Set; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.StringTokenizer; import jav...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
98aa7924b63f580ae51bc155dcbef077
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.StringTokenizer; public class C831 { public static void main(String[] args) throws IOException { Sc...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
cc972c83cf1dda79eb320cdb66c9016f
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
//package cf.n424; import java.util.HashSet; import java.util.Scanner; import java.util.Set; import static java.lang.System.out; public class C { public static void main(String[] args) { Scanner in = new Scanner(System.in); int k = in.nextInt(); int n = in.nextInt(); int[] addi...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
0e0dd7512a0edc610cdfc0c3e832e962
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
//package cf.n424; import java.util.HashSet; import java.util.Scanner; import java.util.Set; import static java.lang.System.out; public class C { public static void main(String[] args) { Scanner in = new Scanner(System.in); int k = in.nextInt(); int n = in.nextInt(); int[] addi...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
8c40b80b6bdc0f13533e2c6e0ed70dc2
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
//package cf.n424; import java.util.HashSet; import java.util.Scanner; import java.util.Set; import static java.lang.System.out; public class C { public static void main(String[] args) { Scanner in = new Scanner(System.in); int k = in.nextInt(); int n = in.nextInt(); int[] s = ...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
bce141f41231068167e3abd1766bca13
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); //BufferedReader bf = new BufferedReader(new InputStreamRead...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
d7f98c8bccb3b373c0f675212c723afd
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.*; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; public class CF_424_D2_C { public static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner(String s) { try { br = new BufferedReader...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
61b2ffc9dabcdda9d52b48c5d2ba0671
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
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.HashSet; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(Syst...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
b98ad9012fecd944167c3af223c7d9c5
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Random; import java.util.StringTokenizer; public class Main { static b...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
403c46b9b52edae7ac463c512efe9031
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.SplittableRandom; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solu...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
53d623eb02bc78d84319d21c140eed1c
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Set; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.TreeSet; import java.io.InputStream; /**...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
c8b399ce59eecf2717204b2efd8045f0
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.TreeSet; import java.io.InputStream; /** * Built using CHelpe...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
6309edbea866a6629f6fc8ffc52ccea4
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Solution { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer s = new StringTokenizer(br.readLine()); int k = Integer.par...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
f8687540d757c4d206dd29c21b657848
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
//CodeForces Round 424 Problem C import java.io.*; import java.util.*; public class cf424c { static class InputReader{ BufferedReader reader; StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader (new InputStreamReader(stream), 32768); tokenizer = null; } ...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
d9c0064152095b409cc61f01d1eec38b
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.*; import java.util.*; //I'm allergic to TLE :( public class JuryMarks { public static void main(String[] args) { FastScanner scan=new FastScanner(); PrintWriter out=new PrintWriter(System.out); HashSet<Integer> h=new HashSet<>(); int n=scan.nextInt(), k=scan.nextInt(); int[] a=new int[n]; ...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
e1961975e76da10dc38cebebf62452d1
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.util.HashSet; import java.util.Scanner; /** * * @author Asus */ public class NewClass3 { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = 0, k= 0; n = in.nextInt(); k = in.nextInt(); int[] a = new int[n]; int[] b =...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
e1f8656b606528d29ba884fc7d690fae
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.math.BigInteger.*; public class C424 { public static boolean has(int[] a, int b) { int l=0, h=a.length - 1; while (h-l>1) { int m = (l+h)/2; if (a[m] > b) h = m; else l = m; } return a[l] == b || a[h] == b; //for (int i=0; i<a...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
3d622e81c984cee4496c5e40140c8425
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashSet; import java.util.StringTokenizer; public class C { public static void main(String[] args) throws IOException { FastS...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
fcf6ab3884d63ce8f29ed4f12f6dcd1c
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import org.omg.CORBA.MARSHAL; import javax.sound.sampled.Line; import java.io.*; import java.math.BigDecimal; import java.nio.Buffer; import java.util.*; import java.util.concurrent.atomic.AtomicReferenceArray; public class codeforces { // public static long fact[]; // public static int mod=1000000007; pu...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
bbf50790a47d8b4bb0ac5506b5b7bfb6
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.TreeSet; public class R424C { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int k = scan.nextInt(); int n = scan.nextInt(); int[] arr = new int[k]; int...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
c137db8fb928c7dbae5a91772862bb31
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
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 r424c { public static void main(String args[])...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
364bf01106e248fb3f6d2f1ab6aae111
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
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 r424c { public static void main(String args[])...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
fc45598777d5670605339ade7cf18e42
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.util.*; import java.io.*; public class meramainmahan { public static void solve(int m[],ArrayList<Integer> g,int c[]){ int think,ans=0; HashSet<Integer> set=new HashSet(); ArrayList<Integer> initials=new ArrayList(); HashSet<Integer> res; for(int j=0;j<c.length;j++){ think=g.get(0)-c[j]; ...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
4f6ac9c971b78446a162033bf3b01deb
train_003.jsonl
1499958300
Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i.Β e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to his score. It is known that the i-th jury member gave ai points.Pol...
256 megabytes
import java.util.*; import java.io.*; public class meramainmahan { public static void solve(int m[],ArrayList<Integer> g,int c[]){ HashSet<Integer> set=new HashSet(); ArrayList<Integer> initials=new ArrayList(); HashSet<Integer> res=new HashSet(); int think,count=0,input,ans=0; for(int j=0;j<c.length;j++)...
Java
["4 1\n-5 5 0 20\n10", "2 2\n-2000 -2000\n3998000 4000000"]
2 seconds
["3", "1"]
NoteThe answer for the first example is 3 because initially the participant could have  - 10, 10 or 15 points.In the second example there is only one correct initial score equaling to 4 002 000.
Java 8
standard input
[ "constructive algorithms", "brute force" ]
6e5b5d357e01d86e1a6dfe7957f57876
The first line contains two integers k and n (1 ≀ n ≀ k ≀ 2 000) β€” the number of jury members and the number of scores Polycarp remembers. The second line contains k integers a1, a2, ..., ak ( - 2 000 ≀ ai ≀ 2 000) β€” jury's marks in chronological order. The third line contains n distinct integers b1, b2, ..., bn ( - 4 ...
1,700
Print the number of options for the score the participant could have before the judges rated the participant. If Polycarp messes something up and there is no options, print "0" (without quotes).
standard output
PASSED
34580c08c1ac54ab45590f3b20efc087
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; public class Yo { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++) arr[i]=sc.nextInt(); HashMap<Integer,Integer> map=new HashMap<>(); ...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
d042704e6774bf0bac970090fe00a972
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.io.*; import java.util.*; public class MyClass { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null ||...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
d75ffb47d8cf577f1065045bf6ae3ed9
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Hello{ public static class MyScanner{ BufferedReader read; StringTokenizer token; public MyScanner(){ read=new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(toke...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
40842e633763216bed9fe11e01ad0d17
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Hello{ public static class MyScanner{ BufferedReader read; StringTokenizer token; public MyScanner(){ read=new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(toke...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
612514a6d8b550b8ab413ab392b9819c
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.HashMap; public class RockandLever { public static void main(String []args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.p...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
37ae412a00187a8035295e4d5d72135d
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; public class Solution { public static void main(String args[] ) throws Exception { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int ii=0;ii<t;ii++) { int n=sc.nextInt(); int[] arr=new int[n]; for(int i=0;i<n;i++...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
e2dedcfe75c8c8b779c4fb85646ddb20
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() ...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
c9d7782d732d7025d578446ab3f634ef
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.StringTokenizer; import java.util.*; import java.io.*; public class A { s...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
eacfdbe689b6c89ac1fc7e9b9bc089df
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
// template halnix16 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; import static java.lang.Math.*; public class Main { static BufferedReader br; public static void main(String[] args) throws Exception { // write your code here br = new BufferedReader...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
25074e135d5dd691a5fd0d8b61dd675c
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); long bits[]=new long[32]; for(int i=0;i<n;i++){ int a=sc.nextInt();...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
e7861c68cb0c64748952c507c8fc0ca5
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; public class B { private static FastScanner fs = new FastScanner(); public static void main(String[] args) { int t = fs.nextInt...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
5416fea662c236108fea8b95d248b193
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
// package codeforces672.cubessorting; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.StringTokenizer; public class B { public static void main(String[] args) { FastScanner fs=new FastScanner(); int T=fs.next...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
03fe8e6fa64b0cc6508303303784968e
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
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 int getpos(int val) { int cnt=0; while(val!=0) { ...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
0ad2d2560a6ddde425bf557f0f2f0252
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; public class B_672 { public static void main(String[] args) throws java.lang.Exception{ Scanner input = new Scanner(System.in); int t = input.nextInt(); for(int i=0;i<t;i++){ input.nextLine(); int n = input.nextInt(); int[] nums = new i...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
5d609224b9f4200328d9864ec8389ce6
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.io.*; import java.util.*; public class Main { final static long mod = (long)10e9+7; static void debug(Object...args) { System.out.println(Arrays.deepToString(args)); } public static void main(String[] args) { InputReader sc = new InputReader(System.in); PrintWrit...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
7fabace6ee8221a3a60491f60ebb60bc
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.uti...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
39193d6127d38af769adddd0fe66de2a
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.uti...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
1b791c94122b423edb515b690b4ac805
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
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.Random; import java.util.StringTokenizer; public class B { public static void main(String[] args) { FastScanner fs=new FastScanner(); int T=fs.nextInt()...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
45f6b57c307c01fae9bf2b94c4477c36
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.uti...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
d2f0248797adae0a4799091075a43e5a
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; public class B { public static PrintWriter out = new PrintWriter(System.out); public static Scanner in = new Scanner(System.in); public static void main(String[] args) { int t = ni(); while (t-- > ...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
722d9ee79e5a7ce7013bf6109f0fe014
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); i...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
7871bc971d0010b4e95ee7d21e90fc95
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; import java.util.HashMap; public class rock{ public static void main(String[] args) { Scanner fs = new Scanner(System.in); int T = fs.nextInt(); for(int t = 0;t<T;t++){ int n = fs.nextInt(); int arr[] = new int[n]; for(int i = 0;i<n;i++...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
3e88a7f6845476039c428d9837476c40
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class solution { public static void main (String[] args) { //code Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); long[] a=new long[n]; for(int i=0;i<n;i++) { a[i]=sc.nex...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
156f79c59d63067baacc6cd6031dd8a8
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; public class rock_and_lever { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int[] a=new int[n+1]; for(int i=0;i<n;i++) { a[i]=sc.nextInt(); } long[] b=new long[32]; for(int i=0;i<n;i++)...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
433e0152cee1eac77566910bc3a8711c
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; public class Rock { public static void main (String[] args) { Scanner scan = new Scanner (System.in); int t = scan.nextInt(); for (int l = 0; l < t; l++) { int n = scan.nextInt(); int[] arr = new int[n]; for (int i = 0; i...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
26f131d7d2672e049346cda87335dc99
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class rocklever { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
92839feb2b054126dd3211c5073af10d
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. *****************************************************...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
fa0fe5093433b3f0b019a9dc399e4dab
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.nio.channels.FileChannel; import java.util.*; import java.util.ArrayList; import java.util.Scanner; public class adaking { static class pair { int first; int second; pair(int a, int b) { first = a; ...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
5792f7b52130089206aaee17d8cdd7c9
train_003.jsonl
1600958100
"You must lift the dam. With a lever. I will give it to you.You must block the canal. With a rock. I will not give the rock to you." Danik urgently needs rock and lever! Obviously, the easiest way to get these things is to ask Hermit Lizard for them.Hermit Lizard agreed to give Danik the lever. But to get a stone, Da...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { //solution start :-) Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { ArrayList<Integer> al = ne...
Java
["5\n5\n1 4 3 7 10\n3\n1 1 1\n4\n6 2 5 3\n2\n2 4\n1\n1"]
1 second
["1\n3\n2\n0\n0"]
NoteIn the first test case there is only one pair: $$$(4,7)$$$: for it $$$4$$$ $$$\&amp;$$$ $$$7 = 4$$$, and $$$4 \oplus 7 = 3$$$.In the second test case all pairs are good.In the third test case there are two pairs: $$$(6,5)$$$ and $$$(2,3)$$$.In the fourth test case there are no good pairs.
Java 11
standard input
[ "bitmasks", "math" ]
04e2e1ce3f0b4efd2d4dda69748a0a25
Each test contains multiple test cases. The first line contains one positive integer $$$t$$$ ($$$1 \le t \le 10$$$) denoting the number of test cases. Description of the test cases follows. The first line of each test case contains one positive integer $$$n$$$ ($$$1 \le n \le 10^5$$$)Β β€” length of the array. The second ...
1,200
For every test case print one non-negative integerΒ β€” the answer to the problem.
standard output
PASSED
4fa1bba19a322ab6fd073ec63160629a
train_003.jsonl
1406480400
You are given three strings (s1, s2, s3). For each integer l (1 ≀ l ≀ min(|s1|, |s2|, |s3|) you need to find how many triples (i1, i2, i3) exist such that three strings sk[ik... ik + l - 1] (k = 1, 2, 3) are pairwise equal. Print all found numbers modulo 1000000007Β (109 + 7).See notes if you are not sure about some of ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.*; public class cf452e { public static void main(String[] args) throws IOException { char s[][] = {rcha(), rcha(), rcha()}; int len[] = {s[0].length, s[1].length, s[2].length}, n = minof(len), ans...
Java
["abc\nbc\ncbc", "abacaba\nabac\nabcd"]
2 seconds
["3 1", "11 2 0 0"]
NoteConsider a string t = t1t2... t|t|, where ti denotes the i-th character of the string, and |t| denotes the length of the string.Then t[i... j] (1 ≀ i ≀ j ≀ |t|) represents the string titi + 1... tj (substring of t from position i to position j inclusive).
Java 11
standard input
[ "data structures", "dsu", "string suffix structures", "strings" ]
607dd33e61f57caced7b61ca8001e871
First three lines contain three non-empty input strings. The sum of lengths of all strings is no more than 3Β·105. All strings consist only of lowercase English letters.
2,400
You need to output min(|s1|, |s2|, |s3|) numbers separated by spaces β€” answers for the problem modulo 1000000007Β (109 + 7).
standard output
PASSED
ace8c057cd652582e548f2954c339829
train_003.jsonl
1510929300
Hands that shed innocent blood!There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of him. All people kill others at the same time. Namely, the i-th person kills the j-th person if and only if j &lt; i and j β‰₯ i - Li.You are gi...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main (String[]args){ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int[] lengths = new int[n]; for (int i = 0; i < n; i++) lengths[i] = scanner.nextInt(); int num...
Java
["4\n0 1 0 10", "2\n0 0", "10\n1 1 3 0 0 0 2 1 0 3"]
2 seconds
["1", "2", "3"]
NoteIn first sample the last person kills everyone in front of him.
Java 11
standard input
[ "two pointers", "implementation", "greedy" ]
beaeeb8757232b141d510547d73ade04
The first line contains one integer n (1 ≀ n ≀ 106) β€” the number of guilty people. Second line contains n space-separated integers L1, L2, ..., Ln (0 ≀ Li ≀ 109), where Li is the length of the i-th person's claw.
1,200
Print one integer β€” the total number of alive people after the bell rings.
standard output
PASSED
f18effa264e5b315efd870afb1393795
train_003.jsonl
1510929300
Hands that shed innocent blood!There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of him. All people kill others at the same time. Namely, the i-th person kills the j-th person if and only if j &lt; i and j β‰₯ i - Li.You are gi...
256 megabytes
// practice with kaiboy import java.io.*; import java.util.*; public class CF892B extends PrintWriter { CF892B() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF892B o = new CF892B(); o.main(); o.flush(); } void main() { int n = sc.nextInt(); int[] ...
Java
["4\n0 1 0 10", "2\n0 0", "10\n1 1 3 0 0 0 2 1 0 3"]
2 seconds
["1", "2", "3"]
NoteIn first sample the last person kills everyone in front of him.
Java 11
standard input
[ "two pointers", "implementation", "greedy" ]
beaeeb8757232b141d510547d73ade04
The first line contains one integer n (1 ≀ n ≀ 106) β€” the number of guilty people. Second line contains n space-separated integers L1, L2, ..., Ln (0 ≀ Li ≀ 109), where Li is the length of the i-th person's claw.
1,200
Print one integer β€” the total number of alive people after the bell rings.
standard output
PASSED
41444173e592266980f055d577b23aa9
train_003.jsonl
1510929300
Hands that shed innocent blood!There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of him. All people kill others at the same time. Namely, the i-th person kills the j-th person if and only if j &lt; i and j β‰₯ i - Li.You are gi...
256 megabytes
import org.w3c.dom.ls.LSOutput; import java.util.*; import java.lang.*; import java.io.*; public class RPS { public static void main(String[] args) throws java.lang.Exception { // BufferedReader br = new BufferedReader(new InputStreamReader((System.in))); // StringTokenizer s = new StringTokenizer(...
Java
["4\n0 1 0 10", "2\n0 0", "10\n1 1 3 0 0 0 2 1 0 3"]
2 seconds
["1", "2", "3"]
NoteIn first sample the last person kills everyone in front of him.
Java 11
standard input
[ "two pointers", "implementation", "greedy" ]
beaeeb8757232b141d510547d73ade04
The first line contains one integer n (1 ≀ n ≀ 106) β€” the number of guilty people. Second line contains n space-separated integers L1, L2, ..., Ln (0 ≀ Li ≀ 109), where Li is the length of the i-th person's claw.
1,200
Print one integer β€” the total number of alive people after the bell rings.
standard output
PASSED
eadf7a17553330dc221c785b66778337
train_003.jsonl
1510929300
Hands that shed innocent blood!There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of him. All people kill others at the same time. Namely, the i-th person kills the j-th person if and only if j &lt; i and j β‰₯ i - Li.You are gi...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Letters { public static void main(String[] args) throws java.lang.Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] le...
Java
["4\n0 1 0 10", "2\n0 0", "10\n1 1 3 0 0 0 2 1 0 3"]
2 seconds
["1", "2", "3"]
NoteIn first sample the last person kills everyone in front of him.
Java 11
standard input
[ "two pointers", "implementation", "greedy" ]
beaeeb8757232b141d510547d73ade04
The first line contains one integer n (1 ≀ n ≀ 106) β€” the number of guilty people. Second line contains n space-separated integers L1, L2, ..., Ln (0 ≀ Li ≀ 109), where Li is the length of the i-th person's claw.
1,200
Print one integer β€” the total number of alive people after the bell rings.
standard output
PASSED
98a0cca486ca119056af24839e6a5f5f
train_003.jsonl
1510929300
Hands that shed innocent blood!There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of him. All people kill others at the same time. Namely, the i-th person kills the j-th person if and only if j &lt; i and j β‰₯ i - Li.You are gi...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Cf182 implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCha...
Java
["4\n0 1 0 10", "2\n0 0", "10\n1 1 3 0 0 0 2 1 0 3"]
2 seconds
["1", "2", "3"]
NoteIn first sample the last person kills everyone in front of him.
Java 11
standard input
[ "two pointers", "implementation", "greedy" ]
beaeeb8757232b141d510547d73ade04
The first line contains one integer n (1 ≀ n ≀ 106) β€” the number of guilty people. Second line contains n space-separated integers L1, L2, ..., Ln (0 ≀ Li ≀ 109), where Li is the length of the i-th person's claw.
1,200
Print one integer β€” the total number of alive people after the bell rings.
standard output
PASSED
361b507b7557646188534aec88317a00
train_003.jsonl
1510929300
Hands that shed innocent blood!There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of him. All people kill others at the same time. Namely, the i-th person kills the j-th person if and only if j &lt; i and j β‰₯ i - Li.You are gi...
256 megabytes
import java.util.*; import java.lang.*; public class Main { public static void main (String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] length = new int[n]; for (int i = 0; i < n; i++) { length[i] = in.nextInt(); } int ali...
Java
["4\n0 1 0 10", "2\n0 0", "10\n1 1 3 0 0 0 2 1 0 3"]
2 seconds
["1", "2", "3"]
NoteIn first sample the last person kills everyone in front of him.
Java 11
standard input
[ "two pointers", "implementation", "greedy" ]
beaeeb8757232b141d510547d73ade04
The first line contains one integer n (1 ≀ n ≀ 106) β€” the number of guilty people. Second line contains n space-separated integers L1, L2, ..., Ln (0 ≀ Li ≀ 109), where Li is the length of the i-th person's claw.
1,200
Print one integer β€” the total number of alive people after the bell rings.
standard output
PASSED
239ab4a9ccc69b670707bfeddb4d4ab6
train_003.jsonl
1510929300
Hands that shed innocent blood!There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of him. All people kill others at the same time. Namely, the i-th person kills the j-th person if and only if j &lt; i and j β‰₯ i - Li.You are gi...
256 megabytes
import java.io.*; import java.util.*; import java.util.Map.Entry; import java.util.stream.*; import java.util.function.*; import java.util.function.Predicate; import java.math.BigInteger; import java.rmi.MarshalException; import java.time.Instant; import java.time.Duration; import java.util.concurrent.*; public class ...
Java
["4\n0 1 0 10", "2\n0 0", "10\n1 1 3 0 0 0 2 1 0 3"]
2 seconds
["1", "2", "3"]
NoteIn first sample the last person kills everyone in front of him.
Java 11
standard input
[ "two pointers", "implementation", "greedy" ]
beaeeb8757232b141d510547d73ade04
The first line contains one integer n (1 ≀ n ≀ 106) β€” the number of guilty people. Second line contains n space-separated integers L1, L2, ..., Ln (0 ≀ Li ≀ 109), where Li is the length of the i-th person's claw.
1,200
Print one integer β€” the total number of alive people after the bell rings.
standard output
PASSED
6a2eaeff4cbad0c8aa5634f6bdaa1298
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class A { public static void main(String[] args) throws FileNotFoundException { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); char[][] b = new char[n][n]; for (int i = 0; i < n; i++) { ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
8bba76755472d03b330c272a0d1f1f48
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.*; public class Code462A { private BufferedReader in; private BufferedWriter out;; private char[][] A; private int gridSize; private boolean isValid; public static void main(String[] args) throws IOException { new Code462A(); } public Code462A() throws IOExcept...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
d2cae5d24e4823c6049b92ec4c87fbb4
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class Appleman_A { public static int n; public static char[][] arr; public static void main(String[] args) { Scanner scan = new Scanner(System.in); n = Integer.parseInt(scan.nextLine()); arr = new char[n][n]; for (int i = 0; i < n; ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
f95ad8b2c2f8cf296f525b9c98473cd0
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.*; public class EasyTask1 { public static void main(String[]args)throws IOException { BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(br.readLine()); char a[][]=new char[n+2][n+2]; int i,j; for(i=1;i<=n;i++) ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
0b272634af3fc57c3dee7de6533f8d32
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class XOGame { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n = in.nextInt(); int [][]input = new int[n][n]; int count=0,previousFlag =0; for(int i=0;i<n;i++) { String random = ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
9763970fdf278fb72978320931d29eb9
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Problem_A { private static MyScanner scanner = new MyScanner(); //private static Scanner scanner = new Scanner(System.in); private static char[][] board; private ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
7594ea715ffda843249cc094eff20b3b
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class Task1 { private static final Scanner sc = new Scanner(System.in); private static int n; public static void main(String[] args) { n = nextInt(); char[][] matrix; matrix = nextCharMatrix(n, n); try { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
20bf5196288f4b7601b62d6149b5725e
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.IOException; import java.util.Scanner; public class Solution { private static final Scanner sc = new Scanner(System.in); private static int n; public static void main(String[] args) { n = nextInt(); char[][] matrix; try { matrix = nextCharMatrix(n, n); String answer = getAnswer(matrix);...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
7d382fd2fd2cad61ff67433ac3bff93f
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class Problem1_26AUG2014 { /** * @param args */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); Scanner sc2 = new Scanner(System.in); int n = sc.nextInt(); char[][] board = new char[n][n]; for (int i = 0; i < n; i++) { String s = sc....
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
5f1aef1b404197fecae5aae3e9e84a2f
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class Task { private static int[] a = {-1, 1}; public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); in.nextLine(); char[][] m = new char[n][]; for (int i = 0; i < n; i++) { m[i] = in.nextLine().toCharArray();...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
89d5b62f2b2420ecd797149f97e344d3
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
//package general_problems; import java.util.Scanner; public class ApplemanandEasyTask { static char array [][]; static int n; static boolean disaster = false; public static void solve(int col, int row){ if (disaster==true){return;} if (col>=n){row++;col=0;} if (row>=n){return;} if (disaster==false){ ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
2f5c5c86c5911c171feee52ed0a23cb9
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
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. */ import java.io.*; /** * * @author DELL */ public class Problem_B { public static void main(String[] args) throws IOException ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
0382d4ff5067741da3e87821ca2dbf93
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.*; import java.io.*; import org.omg.CORBA.FREE_MEM; public class Main implements Runnable { class Message implements Comparable<Message> { int time; String from; String to; boolean completed; Message(String f, String t, int time) { this.time ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
3b1d3fb5cee6eee712b14c2e8790f5c8
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner x=new Scanner (System.in); // BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int n=x.nextInt(); char arr[][]=new char [n][n] ; for(int i=0;i<n;i...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
9a7e04454a775ea3242524b6f88f4776
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.Scanner; public class practice { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char [][] b = new char[n][n]; boolean yes = true; int numo = 0; for(int i = 0; i<n; i++) { String a = sc.next(); int j = 0; for(char z : a.toCharAr...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
281ac4da50a9bbf2a4f2187716509447
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class AppleMan { private void solve() throws IOException { int n = nextInt(); char arr[][] = new char[n][n]; for (int i = 0; i < ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
e8503679623b914b17738e73bea415ba
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.*; public class Code462A { private int size; private int a[][]; public static void main(String args[]){ new Code462A(); } public Code462A(){ readInput(); solve(); } private void solve() { boolean breaking = false; for (int i = 0; ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
f7e05d2aaceacee84693c2e5ccc35b74
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; public class A_ApplemanAndEasyTask { public static char[][] getMatrix(BufferedReader br){ try{ int n = Integer.parseInt(br.readLine()); char [][] ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
d390b1f84bc7bcb2d340eea95c0bd844
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.*; import java.util.*; public class SolutionA { public void solve(){ int n = nextInt(); int ar[][] = new int[n][n]; for (int i = 0; i < n; i++) { String s = nextLine(); for (int j = 0; j < n; j++) { if(s.charAt(j) == '...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
e419de6a09f415f11ad4ba36de9b53a7
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static char [][]map; static int n; public static boolean solve(){ for (int i = 0; i < n; i++) { for (int j = 0;...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
9c4db2c3b12c50db4e4aca79e4876a34
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
270405051d37417d03c2c21b0f799580
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Integer.parseInt; public final class SumDif { public static void main(String[] args) throws IOException{ new SumDif().run(); } BufferedReader in; PrintWriter out; /* int nextInt() throws IOException { in.nextToken(); ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
89a6f5b88ad2de30550d8586e0fb7511
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt();; String s[]=new String[n]; for(int i=0;i<n;i++){ s[i]=in.next(); } for(int i=0;i<n/2;i++) { for(int j=0;j<n;j++) ...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
fbcd1106d44f98ab563e130fbdf793c5
train_003.jsonl
1409061600
Toastman came up with a very easy task. He gives it to Appleman, but Appleman doesn't know how to solve it. Can you help him?Given a n × n checkerboard. Each cell of the board has either character 'x', or character 'o'. Is it true that each cell of the board has even number of adjacent cells with 'o'? Two cells of the ...
256 megabytes
import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchException; import java.util.Linked...
Java
["3\nxxo\nxox\noxx", "4\nxxxo\nxoxo\noxox\nxxxx"]
1 second
["YES", "NO"]
null
Java 7
standard input
[ "implementation", "brute force" ]
03fcf7402397b94edd1d1837e429185d
The first line contains an integer n (1 ≀ n ≀ 100). Then n lines follow containing the description of the checkerboard. Each of them contains n characters (either 'x' or 'o') without spaces.
1,000
Print "YES" or "NO" (without the quotes) depending on the answer to the problem.
standard output
PASSED
0401e2bb81be91600fa2126962360508
train_003.jsonl
1290096000
Baldman is a warp master. He possesses a unique ability β€” creating wormholes! Given two positions in space, Baldman can make a wormhole which makes it possible to move between them in both directions. Unfortunately, such operation isn't free for Baldman: each created wormhole makes him lose plenty of hair from his head...
256 megabytes
import java.util.*; import java.io.*; public class b { public static void main(String[] args) throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(), m = input.nextInt(); Edge[] es = new Edge[m]; for(int i = 0; i<m; i++) { int a...
Java
["2\n1\n1 2 3\n1\n1 2", "3\n1\n1 2 3\n2\n1 2\n1 3"]
4 seconds
["0", "-1\n3"]
null
Java 7
standard input
[ "dfs and similar", "trees", "graphs" ]
14842015e645d41071b04235e155f712
First line of the input contains a single natural number n (2 ≀ n ≀ 100000) β€” the number of objects on the military base. The second line β€” one number m (1 ≀ m ≀ 200000) β€” the number of the wormholes Baldman can make. The following m lines describe the wormholes: each line contains three integer numbers a, b, c (1 ≀ a,...
2,700
Your program should output q lines, one for each query. The i-th line should contain a single integer number β€” the answer for i-th query: the minimum cost (in hair) of a system of wormholes allowing the optimal patrol for any system of tunnels (satisfying the given conditions) if ai and bi are the two objects connected...
standard output
PASSED
4f17ce83da212c5388f139fcfeab523b
train_003.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String a = in.next(); String b = in.next(); String c = in.next(); n = Math.min(n, a.length()); String[] arr = new String...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$)Β β€” the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
d7ca3aca516b63661947f654fa10c852
train_003.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); new Solution().solve(in, out); out.close(); } } class Solution { public void solve(Input...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$)Β β€” the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
1251157b088a5293aaad41c3d1624e84
train_003.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class B979part2 { public static void main(String[] args) throws IOException { BufferedReader inp = new BufferedReader(new InputStreamReader(System.in)); int turns = Integer...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$)Β β€” the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
4f4819dcbe14139523510a57dd1847c2
train_003.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class Main { private static final int MAXN = 5000; private static final String NO = "NO"; private static final String YES...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$)Β β€” the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output
PASSED
fb7aa9e89fc187dd47d8699df24cb745
train_003.jsonl
1526308500
After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her.The three friends are very smart so they passed all the challenges very quickly and finally reached the destination. ...
256 megabytes
import java.util.Scanner; public class TreasureHunt { public static String Solve() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); String kuro = sc.nextLine(), shiro = sc.nextLine(), katie = sc.nextLine(); sc.close(); String[] output = {"Kuro", "Shiro", "Katie", "Draw"}; if...
Java
["3\nKuroo\nShiro\nKatie", "7\ntreasurehunt\nthreefriends\nhiCodeforces", "1\nabcabc\ncbabac\nababca", "15\nfoPaErcvJ\nmZaxowpbt\nmkuOlaHRE"]
1 second
["Kuro", "Shiro", "Katie", "Draw"]
NoteIn the first example, after $$$3$$$ turns, Kuro can change his ribbon into ooooo, which has the beauty of $$$5$$$, while reaching such beauty for Shiro and Katie is impossible (both Shiro and Katie can reach the beauty of at most $$$4$$$, for example by changing Shiro's ribbon into SSiSS and changing Katie's ribbon...
Java 8
standard input
[ "greedy" ]
9b277feec7952947357b133a152fd599
The first line contains an integer $$$n$$$ ($$$0 \leq n \leq 10^{9}$$$)Β β€” the number of turns. Next 3 lines contain 3 ribbons of Kuro, Shiro and Katie one per line, respectively. Each ribbon is a string which contains no more than $$$10^{5}$$$ uppercase and lowercase Latin letters and is not empty. It is guaranteed tha...
1,800
Print the name of the winner ("Kuro", "Shiro" or "Katie"). If there are at least two cats that share the maximum beauty, print "Draw".
standard output