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
5f8f295135ec3980853476326b6c383a
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.util.*; public class taskD { class Point { int x, y; int _len2 = -1; public Point(int x, int y) { this.x = x; this.y = y; } int len2() { if (_len2 != -1) { return _len2; } _len2 = x*...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
2da27dde83a0d66e4982852c7de67af9
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Saransh */ import java.io.*; import java.util.*; import java.math.*; import java.lang.*; public class Main { /** * @param args the command line arguments */ static int arr[][] = ne...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
b25f4af13fe49b555b23ef082506ed8a
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; public class ProblemD { public static int[][] points; public static int INVALID = -1000000; public static int isrect(int[] a) { int ax = points[a[0]][0]; int ay = po...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
aa499bf45195e85a82a898acbf6211ce
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class D { class Point { int idx; long x, y; Point(int idx, long x, long y) { this.idx = idx; this.x = x; this.y = y; } } int ccw(Point A, Point B, ...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
b9af9d8493826a97f98ad55fc3375f48
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.io.FileReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); //Scanner in = new Scanner(new FileReader("Input.txt")); PrintWrite...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
2b2d3d34938a4a55bce7114ee4496cde
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.util.Scanner; public class D { static int[] x,y; static int sol; static boolean found; public static void find(int rem,int mask) { if(found) return; if(rem==0) { long[] sqx=new long[4]; long[] sqy=new long[4]; long[] recx=new long[4]; ...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
fb8f7a31c40a04a890e85cad2d944158
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.StringTokenizer; public class Q136D implements Runnable { int[] x = new int[8]; int[] y = new int[8]; private void solve() throws IOException { for (int i = 0; i < 8; i++) { x[i] = nextInt(); y[i] = nextInt(); ...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
a80ca78eb231e576367b9f165ab66a49
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.io.*; import java.util.*; public class Main { boolean eof; public String nextToken() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch (Exception e) { eof = true; return "-1"; } } return st.nextToken(); } public int nextInt...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
2ba8626130025c682164bdc03bc83049
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; public ...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
2fb10f531a6fe55b50ae93dd7cd4fb1d
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class D { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null; BufferedReader in; PrintWriter out; StringTokenizer tok = new Strin...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
4a8f984faead2cc59ea8f737657489cf
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Scanner; public class D implements Runnable{ public static void main(String[] args) { // TODO Auto-generated method stub new D().run(); } Scanner R...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
7f879be14a400e424584d247a2dd87b2
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main(); } Scanner sc; PrintWriter pw; public Main() { sc = new Scanner(System.in); pw = new PrintWriter(System.out); ...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
85f6a8bcb784dd741aca1ea34ced953d
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.util.Scanner; public class D136 { public static final int N = 8; public static final double eps = 1e-9; static int[] perm; static boolean[] used; static Point[] points; static class Point { int x; int y; public Point(int x, int y) { this.x = ...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
9f74094c13784c67c16947e4c9de56d4
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * Created by IntelliJ IDEA. * User: piyushd * Date: 3/29/11 * Time: 7:56 PM * To ch ange this template use File | Settings | File Templates. */ public class TaskD { int[] x; int[] y; boolea...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
a357d348278a394e1142ef3475ecb4e8
train_000.jsonl
1323443100
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points so that the points from the first set lay at the vertexes of some square and the ...
256 megabytes
import java.util.*; import java.io.PrintWriter; import static java.lang.Math.*; import static java.util.Arrays.*; public class D97 { static Scanner in = new Scanner(System.in); static PrintWriter w = new PrintWriter(System.out, true); static int ni() { return in.nextInt(); } static String nl() { return in.ne...
Java
["0 0\n10 11\n10 0\n0 11\n1 1\n2 2\n2 1\n1 2", "0 0\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n7 7", "0 0\n4 4\n4 0\n0 4\n1 2\n2 3\n3 2\n2 1"]
2 seconds
["YES\n5 6 7 8\n1 2 3 4", "NO", "YES\n1 2 3 4\n5 6 7 8"]
NotePay attention to the third example: the figures do not necessarily have to be parallel to the coordinate axes.
Java 6
standard input
[ "implementation", "geometry", "brute force" ]
a36fb51b1ebb3552308e578477bdce8f
You are given 8 pairs of integers, a pair per line — the coordinates of the points Petya has. The absolute value of all coordinates does not exceed 104. It is guaranteed that no two points coincide.
1,600
Print in the first output line "YES" (without the quotes), if the desired partition exists. In the second line output 4 space-separated numbers — point indexes from the input, which lie at the vertexes of the square. The points are numbered starting from 1. The numbers can be printed in any order. In the third line pri...
standard output
PASSED
7f8368c9cace9ec745c43357ba5ef8ad
train_000.jsonl
1590676500
There are two infinite sources of water: hot water of temperature $$$h$$$; cold water of temperature $$$c$$$ ($$$c &lt; h$$$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infini...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.PriorityQueue; impor...
Java
["3\n30 10 20\n41 15 30\n18 13 18"]
2 seconds
["2\n7\n1"]
NoteIn the first testcase the temperature after $$$2$$$ poured cups: $$$1$$$ hot and $$$1$$$ cold is exactly $$$20$$$. So that is the closest we can achieve.In the second testcase the temperature after $$$7$$$ poured cups: $$$4$$$ hot and $$$3$$$ cold is about $$$29.857$$$. Pouring more water won't get us closer to $$$...
Java 8
standard input
[ "binary search", "math" ]
ca157773d06c7d192589218e2aad6431
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 3 \cdot 10^4$$$) — the number of testcases. Each of the next $$$T$$$ lines contains three integers $$$h$$$, $$$c$$$ and $$$t$$$ ($$$1 \le c &lt; h \le 10^6$$$; $$$c \le t \le h$$$) — the temperature of the hot water, the temperature of the cold water and ...
1,700
For each testcase print a single positive integer — the minimum number of cups required to be poured into the barrel to achieve the closest temperature to $$$t$$$.
standard output
PASSED
bd2705f467b2071f98da3fa42dbf0b31
train_000.jsonl
1590676500
There are two infinite sources of water: hot water of temperature $$$h$$$; cold water of temperature $$$c$$$ ($$$c &lt; h$$$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infini...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class CF1359C { public static void main(String[] args) { FastReader input = new FastReader(); int t = input.nextInt(); while (t > 0){ long hot = ...
Java
["3\n30 10 20\n41 15 30\n18 13 18"]
2 seconds
["2\n7\n1"]
NoteIn the first testcase the temperature after $$$2$$$ poured cups: $$$1$$$ hot and $$$1$$$ cold is exactly $$$20$$$. So that is the closest we can achieve.In the second testcase the temperature after $$$7$$$ poured cups: $$$4$$$ hot and $$$3$$$ cold is about $$$29.857$$$. Pouring more water won't get us closer to $$$...
Java 8
standard input
[ "binary search", "math" ]
ca157773d06c7d192589218e2aad6431
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 3 \cdot 10^4$$$) — the number of testcases. Each of the next $$$T$$$ lines contains three integers $$$h$$$, $$$c$$$ and $$$t$$$ ($$$1 \le c &lt; h \le 10^6$$$; $$$c \le t \le h$$$) — the temperature of the hot water, the temperature of the cold water and ...
1,700
For each testcase print a single positive integer — the minimum number of cups required to be poured into the barrel to achieve the closest temperature to $$$t$$$.
standard output
PASSED
d0879150a6949770b448a1ce826d17db
train_000.jsonl
1590676500
There are two infinite sources of water: hot water of temperature $$$h$$$; cold water of temperature $$$c$$$ ($$$c &lt; h$$$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infini...
256 megabytes
import java.util.*; import java.io.*; public class C1359 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); static StringTokenizer st; public static void main(String[]args)throws IOExcept...
Java
["3\n30 10 20\n41 15 30\n18 13 18"]
2 seconds
["2\n7\n1"]
NoteIn the first testcase the temperature after $$$2$$$ poured cups: $$$1$$$ hot and $$$1$$$ cold is exactly $$$20$$$. So that is the closest we can achieve.In the second testcase the temperature after $$$7$$$ poured cups: $$$4$$$ hot and $$$3$$$ cold is about $$$29.857$$$. Pouring more water won't get us closer to $$$...
Java 8
standard input
[ "binary search", "math" ]
ca157773d06c7d192589218e2aad6431
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 3 \cdot 10^4$$$) — the number of testcases. Each of the next $$$T$$$ lines contains three integers $$$h$$$, $$$c$$$ and $$$t$$$ ($$$1 \le c &lt; h \le 10^6$$$; $$$c \le t \le h$$$) — the temperature of the hot water, the temperature of the cold water and ...
1,700
For each testcase print a single positive integer — the minimum number of cups required to be poured into the barrel to achieve the closest temperature to $$$t$$$.
standard output
PASSED
f63c0b403cb91cb09f3bd81b5b6b5f7a
train_000.jsonl
1590676500
There are two infinite sources of water: hot water of temperature $$$h$$$; cold water of temperature $$$c$$$ ($$$c &lt; h$$$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infini...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class test2{ public static void main (String [] args) throws IOException { try { Scanner sc=new Sca...
Java
["3\n30 10 20\n41 15 30\n18 13 18"]
2 seconds
["2\n7\n1"]
NoteIn the first testcase the temperature after $$$2$$$ poured cups: $$$1$$$ hot and $$$1$$$ cold is exactly $$$20$$$. So that is the closest we can achieve.In the second testcase the temperature after $$$7$$$ poured cups: $$$4$$$ hot and $$$3$$$ cold is about $$$29.857$$$. Pouring more water won't get us closer to $$$...
Java 8
standard input
[ "binary search", "math" ]
ca157773d06c7d192589218e2aad6431
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 3 \cdot 10^4$$$) — the number of testcases. Each of the next $$$T$$$ lines contains three integers $$$h$$$, $$$c$$$ and $$$t$$$ ($$$1 \le c &lt; h \le 10^6$$$; $$$c \le t \le h$$$) — the temperature of the hot water, the temperature of the cold water and ...
1,700
For each testcase print a single positive integer — the minimum number of cups required to be poured into the barrel to achieve the closest temperature to $$$t$$$.
standard output
PASSED
1582b719ee2a88af3d3c6e7dd6045fa8
train_000.jsonl
1590676500
There are two infinite sources of water: hot water of temperature $$$h$$$; cold water of temperature $$$c$$$ ($$$c &lt; h$$$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infini...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { static class Pair implements Comparable<Pair>{ int a; int b; public Pair(int x,int y){a=x;b=y;} public Pair(){} public int compareTo(Pair p){ return p.a - a; } } static class cell implements Comparable<cell>{ ...
Java
["3\n30 10 20\n41 15 30\n18 13 18"]
2 seconds
["2\n7\n1"]
NoteIn the first testcase the temperature after $$$2$$$ poured cups: $$$1$$$ hot and $$$1$$$ cold is exactly $$$20$$$. So that is the closest we can achieve.In the second testcase the temperature after $$$7$$$ poured cups: $$$4$$$ hot and $$$3$$$ cold is about $$$29.857$$$. Pouring more water won't get us closer to $$$...
Java 8
standard input
[ "binary search", "math" ]
ca157773d06c7d192589218e2aad6431
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 3 \cdot 10^4$$$) — the number of testcases. Each of the next $$$T$$$ lines contains three integers $$$h$$$, $$$c$$$ and $$$t$$$ ($$$1 \le c &lt; h \le 10^6$$$; $$$c \le t \le h$$$) — the temperature of the hot water, the temperature of the cold water and ...
1,700
For each testcase print a single positive integer — the minimum number of cups required to be poured into the barrel to achieve the closest temperature to $$$t$$$.
standard output
PASSED
34b56660b7ec0b01170dc8d17d4411d6
train_000.jsonl
1590676500
There are two infinite sources of water: hot water of temperature $$$h$$$; cold water of temperature $$$c$$$ ($$$c &lt; h$$$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infini...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; public class C { // change to name String nameIn = getClass().getSimpleName() + ".i...
Java
["3\n30 10 20\n41 15 30\n18 13 18"]
2 seconds
["2\n7\n1"]
NoteIn the first testcase the temperature after $$$2$$$ poured cups: $$$1$$$ hot and $$$1$$$ cold is exactly $$$20$$$. So that is the closest we can achieve.In the second testcase the temperature after $$$7$$$ poured cups: $$$4$$$ hot and $$$3$$$ cold is about $$$29.857$$$. Pouring more water won't get us closer to $$$...
Java 8
standard input
[ "binary search", "math" ]
ca157773d06c7d192589218e2aad6431
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 3 \cdot 10^4$$$) — the number of testcases. Each of the next $$$T$$$ lines contains three integers $$$h$$$, $$$c$$$ and $$$t$$$ ($$$1 \le c &lt; h \le 10^6$$$; $$$c \le t \le h$$$) — the temperature of the hot water, the temperature of the cold water and ...
1,700
For each testcase print a single positive integer — the minimum number of cups required to be poured into the barrel to achieve the closest temperature to $$$t$$$.
standard output
PASSED
d7ffc555be9eb57dd508c96ee93fdb16
train_000.jsonl
1590676500
There are two infinite sources of water: hot water of temperature $$$h$$$; cold water of temperature $$$c$$$ ($$$c &lt; h$$$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infini...
256 megabytes
// Spaghetti code import java.io.*; import java.math.*; import java.util.*; public class Main { static int mod=(int)(1e9+7); static int mod2=998244353; static PrintWriter pw; static class FastReader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;p...
Java
["3\n30 10 20\n41 15 30\n18 13 18"]
2 seconds
["2\n7\n1"]
NoteIn the first testcase the temperature after $$$2$$$ poured cups: $$$1$$$ hot and $$$1$$$ cold is exactly $$$20$$$. So that is the closest we can achieve.In the second testcase the temperature after $$$7$$$ poured cups: $$$4$$$ hot and $$$3$$$ cold is about $$$29.857$$$. Pouring more water won't get us closer to $$$...
Java 8
standard input
[ "binary search", "math" ]
ca157773d06c7d192589218e2aad6431
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 3 \cdot 10^4$$$) — the number of testcases. Each of the next $$$T$$$ lines contains three integers $$$h$$$, $$$c$$$ and $$$t$$$ ($$$1 \le c &lt; h \le 10^6$$$; $$$c \le t \le h$$$) — the temperature of the hot water, the temperature of the cold water and ...
1,700
For each testcase print a single positive integer — the minimum number of cups required to be poured into the barrel to achieve the closest temperature to $$$t$$$.
standard output
PASSED
b1043428a24caa3d9abe86cb6bda2b8f
train_000.jsonl
1590676500
There are two infinite sources of water: hot water of temperature $$$h$$$; cold water of temperature $$$c$$$ ($$$c &lt; h$$$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infini...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String args[]) { FastReader input=new FastReader(); PrintWriter out=new PrintWriter(System.out); int T=input.nextInt(); while(T-->0) { long h,c,t; h=input.nextInt(); ...
Java
["3\n30 10 20\n41 15 30\n18 13 18"]
2 seconds
["2\n7\n1"]
NoteIn the first testcase the temperature after $$$2$$$ poured cups: $$$1$$$ hot and $$$1$$$ cold is exactly $$$20$$$. So that is the closest we can achieve.In the second testcase the temperature after $$$7$$$ poured cups: $$$4$$$ hot and $$$3$$$ cold is about $$$29.857$$$. Pouring more water won't get us closer to $$$...
Java 8
standard input
[ "binary search", "math" ]
ca157773d06c7d192589218e2aad6431
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 3 \cdot 10^4$$$) — the number of testcases. Each of the next $$$T$$$ lines contains three integers $$$h$$$, $$$c$$$ and $$$t$$$ ($$$1 \le c &lt; h \le 10^6$$$; $$$c \le t \le h$$$) — the temperature of the hot water, the temperature of the cold water and ...
1,700
For each testcase print a single positive integer — the minimum number of cups required to be poured into the barrel to achieve the closest temperature to $$$t$$$.
standard output
PASSED
18b60c4cff3559a091f337f90052a72d
train_000.jsonl
1590676500
There are two infinite sources of water: hot water of temperature $$$h$$$; cold water of temperature $$$c$$$ ($$$c &lt; h$$$). You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infini...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.function.Function; import java.io.Writer; import java.io.Outp...
Java
["3\n30 10 20\n41 15 30\n18 13 18"]
2 seconds
["2\n7\n1"]
NoteIn the first testcase the temperature after $$$2$$$ poured cups: $$$1$$$ hot and $$$1$$$ cold is exactly $$$20$$$. So that is the closest we can achieve.In the second testcase the temperature after $$$7$$$ poured cups: $$$4$$$ hot and $$$3$$$ cold is about $$$29.857$$$. Pouring more water won't get us closer to $$$...
Java 8
standard input
[ "binary search", "math" ]
ca157773d06c7d192589218e2aad6431
The first line contains a single integer $$$T$$$ ($$$1 \le T \le 3 \cdot 10^4$$$) — the number of testcases. Each of the next $$$T$$$ lines contains three integers $$$h$$$, $$$c$$$ and $$$t$$$ ($$$1 \le c &lt; h \le 10^6$$$; $$$c \le t \le h$$$) — the temperature of the hot water, the temperature of the cold water and ...
1,700
For each testcase print a single positive integer — the minimum number of cups required to be poured into the barrel to achieve the closest temperature to $$$t$$$.
standard output
PASSED
6d00ff871ce871e1e01c3a690ac5c6e7
train_000.jsonl
1320333000
You are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1. Your task is to find out if it is possible to rearrange characters in string s so that for any prime number p ≤ |s| and for any integer i ranging from 1 t...
256 megabytes
import java.util.*; import java.io.*; public class Main implements Runnable { public void solve() throws IOException { char[] c = nextToken().toCharArray(); int N = c.length; boolean[] mixed = new boolean[N+1]; for(int i = 2; i <= N; i++){ ...
Java
["abc", "abcd", "xxxyxxx"]
1 second
["YES\nabc", "NO", "YES\nxxxxxxy"]
NoteIn the first sample any of the six possible strings will do: "abc", "acb", "bac", "bca", "cab" or "cba".In the second sample no letter permutation will satisfy the condition at p = 2 (s2 = s4).In the third test any string where character "y" doesn't occupy positions 2, 3, 4, 6 will be valid.
Java 7
standard input
[ "implementation", "number theory", "strings" ]
64700ca85ef3b7408d7d7ad1132f8f81
The only line contains the initial string s, consisting of small Latin letters (1 ≤ |s| ≤ 1000).
1,300
If it is possible to rearrange the characters in the string so that the above-mentioned conditions were fulfilled, then print in the first line "YES" (without the quotes) and print on the second line one of the possible resulting strings. If such permutation is impossible to perform, then print the single string "NO".
standard output
PASSED
e784760b5c13cde307f001a7dc26860f
train_000.jsonl
1320333000
You are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1. Your task is to find out if it is possible to rearrange characters in string s so that for any prime number p ≤ |s| and for any integer i ranging from 1 t...
256 megabytes
import java.util.*; public class Main { static char ans[]; static boolean used[]; static ArrayList<Integer>primes; public static void fill(char a,int len){ for(int i=2;i<=len;i++){ if(check(i,len))continue; ans[i]=a; used[i]=true; } } static boolean check(int a,int len){ for(int c:primes){ if(c > len/2 && c ...
Java
["abc", "abcd", "xxxyxxx"]
1 second
["YES\nabc", "NO", "YES\nxxxxxxy"]
NoteIn the first sample any of the six possible strings will do: "abc", "acb", "bac", "bca", "cab" or "cba".In the second sample no letter permutation will satisfy the condition at p = 2 (s2 = s4).In the third test any string where character "y" doesn't occupy positions 2, 3, 4, 6 will be valid.
Java 7
standard input
[ "implementation", "number theory", "strings" ]
64700ca85ef3b7408d7d7ad1132f8f81
The only line contains the initial string s, consisting of small Latin letters (1 ≤ |s| ≤ 1000).
1,300
If it is possible to rearrange the characters in the string so that the above-mentioned conditions were fulfilled, then print in the first line "YES" (without the quotes) and print on the second line one of the possible resulting strings. If such permutation is impossible to perform, then print the single string "NO".
standard output
PASSED
7930847e26c337438a5d922ef4e89884
train_000.jsonl
1320333000
You are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1. Your task is to find out if it is possible to rearrange characters in string s so that for any prime number p ≤ |s| and for any integer i ranging from 1 t...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main3 { public static class Node implements Comparable<Node> { char a; int count; public Node(char a, int count) { this.count = count; this.a = a; } @Override public int compareTo(Node o) { // TODO Auto-generated method s...
Java
["abc", "abcd", "xxxyxxx"]
1 second
["YES\nabc", "NO", "YES\nxxxxxxy"]
NoteIn the first sample any of the six possible strings will do: "abc", "acb", "bac", "bca", "cab" or "cba".In the second sample no letter permutation will satisfy the condition at p = 2 (s2 = s4).In the third test any string where character "y" doesn't occupy positions 2, 3, 4, 6 will be valid.
Java 7
standard input
[ "implementation", "number theory", "strings" ]
64700ca85ef3b7408d7d7ad1132f8f81
The only line contains the initial string s, consisting of small Latin letters (1 ≤ |s| ≤ 1000).
1,300
If it is possible to rearrange the characters in the string so that the above-mentioned conditions were fulfilled, then print in the first line "YES" (without the quotes) and print on the second line one of the possible resulting strings. If such permutation is impossible to perform, then print the single string "NO".
standard output
PASSED
69b8ae912db52f00266c47746ee096fb
train_000.jsonl
1320333000
You are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1. Your task is to find out if it is possible to rearrange characters in string s so that for any prime number p ≤ |s| and for any integer i ranging from 1 t...
256 megabytes
import java.io.*; import java.util.*; public class Pr123A { public static void main(String[] args) throws IOException { new Pr123A().run(); } BufferedReader in; PrintWriter out; StringTokenizer st; String nextToken() throws IOException { while (st == null || !st.hasMoreTokens()) { st = new StringTokeniz...
Java
["abc", "abcd", "xxxyxxx"]
1 second
["YES\nabc", "NO", "YES\nxxxxxxy"]
NoteIn the first sample any of the six possible strings will do: "abc", "acb", "bac", "bca", "cab" or "cba".In the second sample no letter permutation will satisfy the condition at p = 2 (s2 = s4).In the third test any string where character "y" doesn't occupy positions 2, 3, 4, 6 will be valid.
Java 7
standard input
[ "implementation", "number theory", "strings" ]
64700ca85ef3b7408d7d7ad1132f8f81
The only line contains the initial string s, consisting of small Latin letters (1 ≤ |s| ≤ 1000).
1,300
If it is possible to rearrange the characters in the string so that the above-mentioned conditions were fulfilled, then print in the first line "YES" (without the quotes) and print on the second line one of the possible resulting strings. If such permutation is impossible to perform, then print the single string "NO".
standard output
PASSED
c36efc55364c95a411f28c8e561c9829
train_000.jsonl
1320333000
You are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1. Your task is to find out if it is possible to rearrange characters in string s so that for any prime number p ≤ |s| and for any integer i ranging from 1 t...
256 megabytes
import java.io.*; import java.util.*; public class PrimePermutation { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); String str = f.readLine(); int n = str.length(); char[] a = new char[n]; ...
Java
["abc", "abcd", "xxxyxxx"]
1 second
["YES\nabc", "NO", "YES\nxxxxxxy"]
NoteIn the first sample any of the six possible strings will do: "abc", "acb", "bac", "bca", "cab" or "cba".In the second sample no letter permutation will satisfy the condition at p = 2 (s2 = s4).In the third test any string where character "y" doesn't occupy positions 2, 3, 4, 6 will be valid.
Java 7
standard input
[ "implementation", "number theory", "strings" ]
64700ca85ef3b7408d7d7ad1132f8f81
The only line contains the initial string s, consisting of small Latin letters (1 ≤ |s| ≤ 1000).
1,300
If it is possible to rearrange the characters in the string so that the above-mentioned conditions were fulfilled, then print in the first line "YES" (without the quotes) and print on the second line one of the possible resulting strings. If such permutation is impossible to perform, then print the single string "NO".
standard output
PASSED
b99bab001f4c8eb2b83e83307b8896af
train_000.jsonl
1320333000
You are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1. Your task is to find out if it is possible to rearrange characters in string s so that for any prime number p ≤ |s| and for any integer i ranging from 1 t...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collectio...
Java
["abc", "abcd", "xxxyxxx"]
1 second
["YES\nabc", "NO", "YES\nxxxxxxy"]
NoteIn the first sample any of the six possible strings will do: "abc", "acb", "bac", "bca", "cab" or "cba".In the second sample no letter permutation will satisfy the condition at p = 2 (s2 = s4).In the third test any string where character "y" doesn't occupy positions 2, 3, 4, 6 will be valid.
Java 7
standard input
[ "implementation", "number theory", "strings" ]
64700ca85ef3b7408d7d7ad1132f8f81
The only line contains the initial string s, consisting of small Latin letters (1 ≤ |s| ≤ 1000).
1,300
If it is possible to rearrange the characters in the string so that the above-mentioned conditions were fulfilled, then print in the first line "YES" (without the quotes) and print on the second line one of the possible resulting strings. If such permutation is impossible to perform, then print the single string "NO".
standard output
PASSED
a23d4726dcfb6fe6f543f0ceffa79a23
train_000.jsonl
1320333000
You are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1. Your task is to find out if it is possible to rearrange characters in string s so that for any prime number p ≤ |s| and for any integer i ranging from 1 t...
256 megabytes
import java.util.*; import java.io.*; public class Codeforces { public static void main(String[] args) throws IOException { Reader.init(System.in); String s = Reader.next(); char ans[] = new char[s.length() + 1], ch = 'a'; int freq[] = new i...
Java
["abc", "abcd", "xxxyxxx"]
1 second
["YES\nabc", "NO", "YES\nxxxxxxy"]
NoteIn the first sample any of the six possible strings will do: "abc", "acb", "bac", "bca", "cab" or "cba".In the second sample no letter permutation will satisfy the condition at p = 2 (s2 = s4).In the third test any string where character "y" doesn't occupy positions 2, 3, 4, 6 will be valid.
Java 7
standard input
[ "implementation", "number theory", "strings" ]
64700ca85ef3b7408d7d7ad1132f8f81
The only line contains the initial string s, consisting of small Latin letters (1 ≤ |s| ≤ 1000).
1,300
If it is possible to rearrange the characters in the string so that the above-mentioned conditions were fulfilled, then print in the first line "YES" (without the quotes) and print on the second line one of the possible resulting strings. If such permutation is impossible to perform, then print the single string "NO".
standard output
PASSED
c6d7a591c537e14111959ffae2d5bb18
train_000.jsonl
1320333000
You are given a string s, consisting of small Latin letters. Let's denote the length of the string as |s|. The characters in the string are numbered starting from 1. Your task is to find out if it is possible to rearrange characters in string s so that for any prime number p ≤ |s| and for any integer i ranging from 1 t...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.text.*; public class Main { private static final int MAXN = 1111; private static int[] fa = new int[ MAXN ]; private static int[] cnt = new int[ MAXN ]; private static int[] acnt = new int[ 88 ]; private static int n ; private static String ...
Java
["abc", "abcd", "xxxyxxx"]
1 second
["YES\nabc", "NO", "YES\nxxxxxxy"]
NoteIn the first sample any of the six possible strings will do: "abc", "acb", "bac", "bca", "cab" or "cba".In the second sample no letter permutation will satisfy the condition at p = 2 (s2 = s4).In the third test any string where character "y" doesn't occupy positions 2, 3, 4, 6 will be valid.
Java 7
standard input
[ "implementation", "number theory", "strings" ]
64700ca85ef3b7408d7d7ad1132f8f81
The only line contains the initial string s, consisting of small Latin letters (1 ≤ |s| ≤ 1000).
1,300
If it is possible to rearrange the characters in the string so that the above-mentioned conditions were fulfilled, then print in the first line "YES" (without the quotes) and print on the second line one of the possible resulting strings. If such permutation is impossible to perform, then print the single string "NO".
standard output
PASSED
a6a362eb085926683ccca27ebe1c1ffb
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class apples{ public static void main(String[] args) { Scanner zizo=new Scanner(System.in); int n=zizo.nextInt(); String l="I love that"; String h="I hate that"; String r="";...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
122abddd05e93ab0c6bc235bf6beb5ed
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.Scanner; public class imagine { private static Scanner butts; public static void main(String[] args) { butts = new Scanner(System.in); int n = butts.nextInt(); int shiva = 0; for(int i = 1; i < n; i++) { shiva=i; if(i%2==0) { ...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
3b5103b2beb9896517421be47e878515
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); Zidan(Integer.parseInt(sc.nextLine())); } public static void Zidan(int x){ String y=""; for (int i=1 ; i <= x-1 ; i++ ){ if (i%2==0){ ...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
3ecea9ef4a539c129c8fd5e91530163d
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.Scanner; public class apples { public static void main (String args[]) { Scanner sc=new Scanner(System.in); int a=sc.nextInt(); for (int i=1;i<=a;i++) { if (i%2!=0) { if(i==a) System.out.print("I hate it"); else System.out.print("I hate that"); } else { ...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
e1c08282e26a2b6e2e4e7d9de7e335db
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.Scanner; public class Hulk { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String res = ""; for (int i = 1; i <= n; i++) { if ((i & 1) == 0) res += "I love"; else res += "I hate"; if (i != n) res += " that "; else ...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
32a8d116652ab5763671c46af51cbb07
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.Scanner; public class Hulk { /** * */ public static int feelingNum = 0 ; public static String printMessage = ""; public static void main(String[] args) { Scanner myScanner = new Scanner(System.in); int num = myScanner.nextInt(); for (in...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
7ae873662aaa6dc24f425f408063fc85
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.Scanner; /** * * @author abosala7 */ public class Hulk { /** * */ public static int feelingNum = 0 ; public static String printMessage = ""; public static void main(String[] args) { Scanner myScanner = new Scanner(System.in); int num = myScan...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
edb066a29b8dfdd2ba0a4ef1221bc653
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.Scanner; /** * * @author abosala7 */ public class Hulk { public static void main(String[] args) { int feelingNum = 0 ; String printMessage = ""; Scanner myScanner = new Scanner(System.in); int num = myScanner.nextInt(); for (int i = 0 ; i < num ; i+...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
e6d16d46056898a7701d50b11f015598
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.*; public class hulk { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); boolean flag=true; String s=""; for(int i=0;i<n;i++){ if(flag==true){ s="hate"; flag=false; } else{ s="love"; ...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
e886af42ccf8a4173f8d2313d0463c89
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.*; public class hulk { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); boolean flag=true; String s=""; if(n==1) System.out.println("I hate it"); else{ for(int i=0;i<n;i++){ if(flag==true){ s="ha...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
22b44ee56f24f737c07d47054ef6801b
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.Scanner; public class DrHulk { private static String Lt = "I love that"; private static String Ht = "I hate that"; private static String Li = "I love it"; private static String Hi = "I hate it" ; public static void main(String[] args) { Scanner rd = new Scanner(System.in); ...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
7d2edf0ac453245ccaf17ae0a61aa0bc
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Hulk { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String x = br.readLine(); int y = Integer.parseInt(x); for (int i ...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
a253da4c600180f394077ddd7e3d02ce
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Hulk { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String x = br.readLine(); int y = Integer.parseInt(x); for (int i ...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
0ecd1aba17d008ddeff9c0c084dbe432
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.Scanner; public class main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); // your code goes here int num=sc.nextInt(); System.out.print("I hate "); for(int i=1;i<num;i++) { System.out.print(...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
05f686773a7230bf7948eba8c3761290
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.*; public class Hulk{ public static void main(String[] Args){ Scanner sc= new Scanner(System.in); int n= sc.nextInt(); if(n==1) System.out.print("I hate it"); if(n==2) System.out.print("I hate that I love it"); else{ for(int i=1;i<n;i++){ if(i%2==0){ System.out.print("I love that ");} else{ S...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
cb7bc54deff6e1232406a3f03c1954e5
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.*; public class Main6{ public static void main (String[]args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if(0<=n&&n<=100){ for(int i = 1; i<n+1 ;i++){ if(i%2==1) System.out.print("I hate"); else System.out.print("I love"); if(i==n) System.out.print(" it "...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
6671620c928006001aad3a9865d113fc
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.*; public class Main{ public static void main (String[]args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if(0<=n&&n<=100){ for(int i = 1; i<n+1 ;i++){ if(i%2==1) System.out.print("I hate"); else System.out.print("I love"); if(i==n) System.out.print(" it ")...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
f2da271320415b7611a330cded54bffe
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.*; public class Main8{ public static void main (String[]args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if(0<=n&&n<=100){ for(int i = 1; i<n+1 ;i++){ if(i%2==1) System.out.print("I hate"); else System.out.print("I love"); if(i==n) System.out.print(" it "...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
6c42bd14352d4ebad77bec524066cd04
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.*; public class Hulk { public static void main(String[] args) { long startTime = System.currentTimeMillis(); Scanner kbd = new Scanner(System.in); double num = kbd.nextInt(); double counter = 0; double x; if(num == 1) System.out.print("I ...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
4d1bcce744603a994a8b5376cd3fef53
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.*; public class Hulk { public static void main(String[] args) { long startTime = System.currentTimeMillis(); Scanner kbd = new Scanner(System.in); double num = kbd.nextInt(); double counter = 0; double x; if(num == 1) System.out.print("I ...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
5c69d60fc9bdcbf478b6297e500e983a
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
//705A import java.util.*; public class Hulk { public static void main(String[] args) { long startTime = System.currentTimeMillis(); Scanner kbd = new Scanner(System.in); double num = kbd.nextInt(); double counter = 0; double x; if(num == 1) System.out.pri...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
4b2741af834edc7aa65feb1470da6c83
train_000.jsonl
1470578700
Dr. Bruce Banner hates his enemies (like others don't). As we all know, he can barely talk when he turns into the incredible Hulk. That's why he asked you to help him to express his feelings.Hulk likes the Inception so much, and like that his feelings are complicated. They have n layers. The first layer is hate, second...
256 megabytes
import java.util.*; public class Hulk { public static void main(String[] args) { String s = ""; Scanner kbd = new Scanner(System.in); int n = kbd.nextInt(); String str1 = "I hate "; String str2 = "I love "; if(n==1) { s+=str1; System.out.print(s); } else { int t = n-1; for(int i=0;i...
Java
["1", "2", "3"]
1 second
["I hate it", "I hate that I love it", "I hate that I love that I hate it"]
null
Java 8
standard input
[ "implementation" ]
7f2441cfb32d105607e63020bed0e145
The only line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of layers of love and hate.
800
Print Dr.Banner's feeling in one line.
standard output
PASSED
3abd71a3ba5f376a62ada54ca9392f82
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.util.*; public class CountTheRectangles { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); List<Segment> horizontal = new ArrayList<>(); List<Segment> vertical = new ArrayList<>(); for (int i = 0; i < n; i++) { ...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
83d082952a5c317e538f2297a6621681
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.util.*; public class CountTheRectangles2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); List<Segment> horizontal = new ArrayList<>(); List<Segment> vertical = new ArrayList<>(); for (int i = 0; i < n; i++) {...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
0bd999c017d6b301b7fb4413fdda048c
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.util.*; public class CountTheRectangles3 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); List<Segment> horizontal = new ArrayList<>(); List<Segment> vertical = new ArrayList<>(); for (int i = 0; i < n; i++) {...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
345ee89010fc23e7d51807a8e564d9bc
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int maxn = 5001; static class Node { int x1, x2, y1, y2; public Node(int x1, int x2, int y1, int y2){ this.x1 = x1; this.x2 = x2; this.y1 = y1; this.y2 = y2; } } ...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
28227e6bab08e826b7eb9bd89b964b62
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.util.*; import java.io.*; public class tr0 { static PrintWriter out; static StringBuilder sb; static int mod = 998244353; static long inf = (long) 1e16; static int[] l, r; static int n, m, id; static long all, ans; static ArrayList<Integer>[] ad; static long[][][] memo; static long[] a; static A...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
6a791e1030f565aceebec49081c53e85
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Comparator; import java.io.InputStream...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
04e9a25468d5e67f92e936b31591d7f9
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Comparator; import java.io.InputStream...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
a140f93aa6db9a770c86bd1b3d75d8d0
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Comparator; import java.io.InputStream...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
58501095cdc14bf342ddafda6b868f79
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.util.Comparator; import java.io.InputStream...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
1b32f5575716db12dbc35da2449d8059
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
629fd0438abd3908ba4f9c2366541689
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
4bfbf0654f5052476b1db868096bea5d
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
556ea3abed58f84c040d6751da0ae41f
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
//package educational.round68; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; public class E2 { InputStream is; PrintWriter out; String INPUT = "";...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
ceaaeadbc873e87ae494be6fcf0990a3
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.util.*; public class E implements Runnable { public static void main (String[] args) {new Thread(null, new E(), "_cf", 1 << 28).start();} public void run() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); System.err.println(""); ArrayList<Li...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
e141c38af309cad7c39331115932435c
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.util.*; import java.io.*; public class RectCount { static BufferedReader br; static StringTokenizer tokenizer; public static void main(String[] args) throws Exception { br = new BufferedReader(new InputStreamReader(System.in)); int n = nextInt(); BIT b; boolean[] intersects; ArrayList<CLine> ...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
ece34c2a8362446edb29232c8ca2b1a6
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
/* If you want to aim high, aim high Don't let that studying and grades consume you Just live life young ****************************** If I'm the sun, you're the moon Because when I go up, you go down ******************************* */ import java.util.*; import java.io.*; public class x1194E2 { public st...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
270dfa88e99d57c5d53b0386e196d3f0
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.util.ArrayList; import java.util.List; im...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
7b6d25c848257be2f14c6acd88dea6d7
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int maxn = 5001; static class Node { int x1, x2, y1, y2; public Node(int x1, int x2, int y1, int y2){ this.x1 = x1; this.x2 = x2; this.y1 = y1; this.y2 = y2; } } s...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
7e72afb791d3ee81548b13beb69fd9e5
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.util.*; public class Solution { int N = 10002; int maxn = 5001; int [] f; private int sum(int index){ int sum = 0; while(index > 0){ sum += f[index]; index -= (index & (-index)); } return sum; } public vo...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
e473a922ce05b8a138c104f6d33e6052
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } long mod=1000000007; long gcd(long a,long b) { return a==0?b:gcd(b%a,a);...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
11c0e8426676bf20455798c8d06089c4
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.text.*; import java.util.*; import java.math.*; public class template { public static void main(String[] args) throws Exception { new template().run(); } public void run() throws Exception { FastScanner f = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int n ...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
97c3b88e7c7094c632eceb3b8b15ea60
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.nio.CharBuffer; import java.util.ArrayList; import java.util.Comparator; import java.util.NoSuchElementException; public class P1194E { private static final int MAX = 10000; public static void main(String[] args) { SimpleScanner scanner = new SimpleScanner(System.in); ...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
ab769d4b7b1b70fa6923542bf4b9bed4
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.*; import java.nio.CharBuffer; import java.util.ArrayList; import java.util.Comparator; import java.util.NoSuchElementException; public class P1194E { private static final int MAX = 10000; public static void main(String[] args) { SimpleScanner scanner = new SimpleScanner(System.in); ...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
ada439d951594f5df2aedd40e85e3636
train_000.jsonl
1563115500
There are $$$n$$$ segments drawn on a plane; the $$$i$$$-th segment connects two points ($$$x_{i, 1}$$$, $$$y_{i, 1}$$$) and ($$$x_{i, 2}$$$, $$$y_{i, 2}$$$). Each segment is non-degenerate, and is either horizontal or vertical — formally, for every $$$i \in [1, n]$$$ either $$$x_{i, 1} = x_{i, 2}$$$ or $$$y_{i, 1} = y...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.InputMismatchException; import java.io.OutputStreamWriter; import java.util.NoSuchElementException; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Iterator; import ja...
Java
["7\n-1 4 -1 -2\n6 -1 -2 -1\n-2 3 6 3\n2 -2 2 4\n4 -1 4 3\n5 3 5 1\n5 2 1 2", "5\n1 5 1 0\n0 1 5 1\n5 4 0 4\n4 2 4 0\n4 3 4 5"]
2 seconds
["7", "0"]
NoteThe following pictures represent sample cases:
Java 8
standard input
[ "geometry", "bitmasks", "sortings", "data structures", "brute force" ]
09890f75bdcfff81f67eb915379b325e
The first line contains one integer $$$n$$$ ($$$1 \le n \le 5000$$$) — the number of segments. Then $$$n$$$ lines follow. The $$$i$$$-th line contains four integers $$$x_{i, 1}$$$, $$$y_{i, 1}$$$, $$$x_{i, 2}$$$ and $$$y_{i, 2}$$$ denoting the endpoints of the $$$i$$$-th segment. All coordinates of the endpoints are in...
2,200
Print one integer — the number of ways to choose four segments so they form a rectangle.
standard output
PASSED
e7d679b214c26fec239f92625f825433
train_000.jsonl
1468137600
"The zombies are lurking outside. Waiting. Moaning. And when they come...""When they come?""I hope the Wall is high enough."Zombie attacks have hit the Wall, our line of defense in the North. Its protection is failing, and cracks are showing. In places, gaps have appeared, splitting the wall into multiple segments. We ...
256 megabytes
import java.util.Scanner; public class D1_690 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int R = in.nextInt(); in.nextInt(); // C String row = null; for (int r=0; r<R; r++) { row = in.next(); } int answer = 0;...
Java
["3 7\n.......\n.......\n.BB.B..", "4 5\n..B..\n..B..\nB.B.B\nBBB.B", "4 6\n..B...\nB.B.BB\nBBB.BB\nBBBBBB", "1 1\nB", "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...B...\nB.BB.B.", "8 8\n........\n........\n........\n........\n.B......\n.B.....B\n.B.....B\n.BB...BB"]
0.5 seconds
["2", "2", "1", "1", "3", "2"]
NoteIn the first sample case, the 2nd and 3rd columns define the first wall segment, and the 5th column defines the second.
Java 8
standard input
[]
c339795767a174a59225a79023b5d14f
The first line of the input consists of two space-separated integers R and C, 1 ≤ R, C ≤ 100. The next R lines provide a description of the columns as follows: each of the R lines contains a string of length C, the c-th character of line r is B if there is a brick in column c and row R - r + 1, and . otherwise. B
1,200
The number of wall segments in the input configuration.
standard output
PASSED
6fb25eafcbd847a8795c923537462681
train_000.jsonl
1468137600
"The zombies are lurking outside. Waiting. Moaning. And when they come...""When they come?""I hope the Wall is high enough."Zombie attacks have hit the Wall, our line of defense in the North. Its protection is failing, and cracks are showing. In places, gaps have appeared, splitting the wall into multiple segments. We ...
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.util.*; import java.io.*; /** * * @author root */ public class D1 { static int map[][]; static boolean visite...
Java
["3 7\n.......\n.......\n.BB.B..", "4 5\n..B..\n..B..\nB.B.B\nBBB.B", "4 6\n..B...\nB.B.BB\nBBB.BB\nBBBBBB", "1 1\nB", "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...B...\nB.BB.B.", "8 8\n........\n........\n........\n........\n.B......\n.B.....B\n.B.....B\n.BB...BB"]
0.5 seconds
["2", "2", "1", "1", "3", "2"]
NoteIn the first sample case, the 2nd and 3rd columns define the first wall segment, and the 5th column defines the second.
Java 8
standard input
[]
c339795767a174a59225a79023b5d14f
The first line of the input consists of two space-separated integers R and C, 1 ≤ R, C ≤ 100. The next R lines provide a description of the columns as follows: each of the R lines contains a string of length C, the c-th character of line r is B if there is a brick in column c and row R - r + 1, and . otherwise. B
1,200
The number of wall segments in the input configuration.
standard output
PASSED
d2f9c7c83177169517ffaadd4c1da944
train_000.jsonl
1468137600
"The zombies are lurking outside. Waiting. Moaning. And when they come...""When they come?""I hope the Wall is high enough."Zombie attacks have hit the Wall, our line of defense in the North. Its protection is failing, and cracks are showing. In places, gaps have appeared, splitting the wall into multiple segments. We ...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String[] args) { Scanner s = new Scanner(System.in); int r = s.nextInt(), c = s.nextInt(); s.nextLine(); char[] lastRow = new char[c]; for(int i = 0; i < r; i++) { if(i == r-1) { lastRow = s.nextLine().toCharArray(); }...
Java
["3 7\n.......\n.......\n.BB.B..", "4 5\n..B..\n..B..\nB.B.B\nBBB.B", "4 6\n..B...\nB.B.BB\nBBB.BB\nBBBBBB", "1 1\nB", "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...B...\nB.BB.B.", "8 8\n........\n........\n........\n........\n.B......\n.B.....B\n.B.....B\n.BB...BB"]
0.5 seconds
["2", "2", "1", "1", "3", "2"]
NoteIn the first sample case, the 2nd and 3rd columns define the first wall segment, and the 5th column defines the second.
Java 8
standard input
[]
c339795767a174a59225a79023b5d14f
The first line of the input consists of two space-separated integers R and C, 1 ≤ R, C ≤ 100. The next R lines provide a description of the columns as follows: each of the R lines contains a string of length C, the c-th character of line r is B if there is a brick in column c and row R - r + 1, and . otherwise. B
1,200
The number of wall segments in the input configuration.
standard output
PASSED
0316a650511025d9a0004c43c100cb4d
train_000.jsonl
1468137600
"The zombies are lurking outside. Waiting. Moaning. And when they come...""When they come?""I hope the Wall is high enough."Zombie attacks have hit the Wall, our line of defense in the North. Its protection is failing, and cracks are showing. In places, gaps have appeared, splitting the wall into multiple segments. We ...
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 7\n.......\n.......\n.BB.B..", "4 5\n..B..\n..B..\nB.B.B\nBBB.B", "4 6\n..B...\nB.B.BB\nBBB.BB\nBBBBBB", "1 1\nB", "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...B...\nB.BB.B.", "8 8\n........\n........\n........\n........\n.B......\n.B.....B\n.B.....B\n.BB...BB"]
0.5 seconds
["2", "2", "1", "1", "3", "2"]
NoteIn the first sample case, the 2nd and 3rd columns define the first wall segment, and the 5th column defines the second.
Java 8
standard input
[]
c339795767a174a59225a79023b5d14f
The first line of the input consists of two space-separated integers R and C, 1 ≤ R, C ≤ 100. The next R lines provide a description of the columns as follows: each of the R lines contains a string of length C, the c-th character of line r is B if there is a brick in column c and row R - r + 1, and . otherwise. B
1,200
The number of wall segments in the input configuration.
standard output
PASSED
aae65774e2b16238228b8766b744470c
train_000.jsonl
1468137600
"The zombies are lurking outside. Waiting. Moaning. And when they come...""When they come?""I hope the Wall is high enough."Zombie attacks have hit the Wall, our line of defense in the North. Its protection is failing, and cracks are showing. In places, gaps have appeared, splitting the wall into multiple segments. We ...
256 megabytes
import java.util.Scanner; public class King { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r = sc.nextInt(); int c = sc.nextInt(); int k = 0; int l = 1; String s = ""; for (int i = 0; i < r; i++) { s = sc.next(...
Java
["3 7\n.......\n.......\n.BB.B..", "4 5\n..B..\n..B..\nB.B.B\nBBB.B", "4 6\n..B...\nB.B.BB\nBBB.BB\nBBBBBB", "1 1\nB", "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...B...\nB.BB.B.", "8 8\n........\n........\n........\n........\n.B......\n.B.....B\n.B.....B\n.BB...BB"]
0.5 seconds
["2", "2", "1", "1", "3", "2"]
NoteIn the first sample case, the 2nd and 3rd columns define the first wall segment, and the 5th column defines the second.
Java 8
standard input
[]
c339795767a174a59225a79023b5d14f
The first line of the input consists of two space-separated integers R and C, 1 ≤ R, C ≤ 100. The next R lines provide a description of the columns as follows: each of the R lines contains a string of length C, the c-th character of line r is B if there is a brick in column c and row R - r + 1, and . otherwise. B
1,200
The number of wall segments in the input configuration.
standard output
PASSED
d2393aae645ad62fb98e490dd2fe662c
train_000.jsonl
1468137600
"The zombies are lurking outside. Waiting. Moaning. And when they come...""When they come?""I hope the Wall is high enough."Zombie attacks have hit the Wall, our line of defense in the North. Its protection is failing, and cracks are showing. In places, gaps have appeared, splitting the wall into multiple segments. We ...
256 megabytes
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main { private static Set<Integer> integers; private static int wall[][]; private static int R; private static int C; public static void main(String[] args) { integers = new HashSet<>(); Scanner scanner = new Scanner(Sys...
Java
["3 7\n.......\n.......\n.BB.B..", "4 5\n..B..\n..B..\nB.B.B\nBBB.B", "4 6\n..B...\nB.B.BB\nBBB.BB\nBBBBBB", "1 1\nB", "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...B...\nB.BB.B.", "8 8\n........\n........\n........\n........\n.B......\n.B.....B\n.B.....B\n.BB...BB"]
0.5 seconds
["2", "2", "1", "1", "3", "2"]
NoteIn the first sample case, the 2nd and 3rd columns define the first wall segment, and the 5th column defines the second.
Java 8
standard input
[]
c339795767a174a59225a79023b5d14f
The first line of the input consists of two space-separated integers R and C, 1 ≤ R, C ≤ 100. The next R lines provide a description of the columns as follows: each of the R lines contains a string of length C, the c-th character of line r is B if there is a brick in column c and row R - r + 1, and . otherwise. B
1,200
The number of wall segments in the input configuration.
standard output
PASSED
1c75c436ec262e43d1e4448d0c0398dd
train_000.jsonl
1468137600
"The zombies are lurking outside. Waiting. Moaning. And when they come...""When they come?""I hope the Wall is high enough."Zombie attacks have hit the Wall, our line of defense in the North. Its protection is failing, and cracks are showing. In places, gaps have appeared, splitting the wall into multiple segments. We ...
256 megabytes
import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; import java.io.InputStream; import java.io.InputStreamReader; /** * Built using CHelper plug-in * Actual solution is at the top * @author Igor Kraskevich */ public c...
Java
["3 7\n.......\n.......\n.BB.B..", "4 5\n..B..\n..B..\nB.B.B\nBBB.B", "4 6\n..B...\nB.B.BB\nBBB.BB\nBBBBBB", "1 1\nB", "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...B...\nB.BB.B.", "8 8\n........\n........\n........\n........\n.B......\n.B.....B\n.B.....B\n.BB...BB"]
0.5 seconds
["2", "2", "1", "1", "3", "2"]
NoteIn the first sample case, the 2nd and 3rd columns define the first wall segment, and the 5th column defines the second.
Java 8
standard input
[]
c339795767a174a59225a79023b5d14f
The first line of the input consists of two space-separated integers R and C, 1 ≤ R, C ≤ 100. The next R lines provide a description of the columns as follows: each of the R lines contains a string of length C, the c-th character of line r is B if there is a brick in column c and row R - r + 1, and . otherwise. B
1,200
The number of wall segments in the input configuration.
standard output
PASSED
091122f071b8be8c53351d8b9e035c42
train_000.jsonl
1468137600
"The zombies are lurking outside. Waiting. Moaning. And when they come...""When they come?""I hope the Wall is high enough."Zombie attacks have hit the Wall, our line of defense in the North. Its protection is failing, and cracks are showing. In places, gaps have appeared, splitting the wall into multiple segments. We ...
256 megabytes
import java.util.*; import java.io.*; public class D1{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); String[] line = br.readLine().split(" "); int r =...
Java
["3 7\n.......\n.......\n.BB.B..", "4 5\n..B..\n..B..\nB.B.B\nBBB.B", "4 6\n..B...\nB.B.BB\nBBB.BB\nBBBBBB", "1 1\nB", "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...B...\nB.BB.B.", "8 8\n........\n........\n........\n........\n.B......\n.B.....B\n.B.....B\n.BB...BB"]
0.5 seconds
["2", "2", "1", "1", "3", "2"]
NoteIn the first sample case, the 2nd and 3rd columns define the first wall segment, and the 5th column defines the second.
Java 8
standard input
[]
c339795767a174a59225a79023b5d14f
The first line of the input consists of two space-separated integers R and C, 1 ≤ R, C ≤ 100. The next R lines provide a description of the columns as follows: each of the R lines contains a string of length C, the c-th character of line r is B if there is a brick in column c and row R - r + 1, and . otherwise. B
1,200
The number of wall segments in the input configuration.
standard output
PASSED
34a91600d14933ce8684878c86b3d65d
train_000.jsonl
1468137600
"The zombies are lurking outside. Waiting. Moaning. And when they come...""When they come?""I hope the Wall is high enough."Zombie attacks have hit the Wall, our line of defense in the North. Its protection is failing, and cracks are showing. In places, gaps have appeared, splitting the wall into multiple segments. We ...
256 megabytes
import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class Main4easy { public static void runBFS(boolean[][] mat, int i, int j, int H, int W){ Queue<Par> q = new LinkedList<>(); q.add(new Par(i, j)); mat[i][j] = false; while(!q.isEmpty()){ ...
Java
["3 7\n.......\n.......\n.BB.B..", "4 5\n..B..\n..B..\nB.B.B\nBBB.B", "4 6\n..B...\nB.B.BB\nBBB.BB\nBBBBBB", "1 1\nB", "10 7\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n.......\n...B...\nB.BB.B.", "8 8\n........\n........\n........\n........\n.B......\n.B.....B\n.B.....B\n.BB...BB"]
0.5 seconds
["2", "2", "1", "1", "3", "2"]
NoteIn the first sample case, the 2nd and 3rd columns define the first wall segment, and the 5th column defines the second.
Java 8
standard input
[]
c339795767a174a59225a79023b5d14f
The first line of the input consists of two space-separated integers R and C, 1 ≤ R, C ≤ 100. The next R lines provide a description of the columns as follows: each of the R lines contains a string of length C, the c-th character of line r is B if there is a brick in column c and row R - r + 1, and . otherwise. B
1,200
The number of wall segments in the input configuration.
standard output
PASSED
03e0c60027fdd3c20b32896960fe5103
train_000.jsonl
1422376200
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second to light one candle. More formally, Anya can spend one second to light one can...
256 megabytes
import java.io.*; import java.util.*; public class CodeForces { int visitors, durationOfCandle, minimumBurningCandlePerVisit; int candlesStillBurningForNextVisit, extraCandlesNeededForNextVisit; int periodToTheNextVisit; int totalCandlesNeeded; public void solve() { visitors = in.nextInt(); durationOfCandl...
Java
["1 8 3\n10", "2 10 1\n5 8", "1 1 3\n10"]
2 seconds
["3", "1", "-1"]
NoteAnya can start lighting a candle in the same second with ghost visit. But this candle isn't counted as burning at this visit.It takes exactly one second to light up a candle and only after that second this candle is considered burning; it means that if Anya starts lighting candle at moment x, candle is buring from ...
Java 8
standard input
[ "constructive algorithms", "greedy" ]
03772bac6ed5bfe75bc0ad4d2eab56fd
The first line contains three integers m, t, r (1 ≤ m, t, r ≤ 300), representing the number of ghosts to visit Anya, the duration of a candle's burning and the minimum number of candles that should burn during each visit. The next line contains m space-separated numbers wi (1 ≤ i ≤ m, 1 ≤ wi ≤ 300), the i-th of them r...
1,600
If it is possible to make at least r candles burn during each visit, then print the minimum number of candles that Anya needs to light for that. If that is impossible, print  - 1.
standard output
PASSED
ae98b86e592f15387201496e7b5300f8
train_000.jsonl
1422376200
Anya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly t seconds. It takes the girl one second to light one candle. More formally, Anya can spend one second to light one can...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Prob7 { public static void trier(int a[],int r) { for(int i=0;i<r;i++) { for(int j=i+1;j<r;j++) { if(a[i]>a[j]) { int c=a[j]; a[j]=a[i]; a[i]=c; } } } } public static int generer(int visite,int duree,in...
Java
["1 8 3\n10", "2 10 1\n5 8", "1 1 3\n10"]
2 seconds
["3", "1", "-1"]
NoteAnya can start lighting a candle in the same second with ghost visit. But this candle isn't counted as burning at this visit.It takes exactly one second to light up a candle and only after that second this candle is considered burning; it means that if Anya starts lighting candle at moment x, candle is buring from ...
Java 8
standard input
[ "constructive algorithms", "greedy" ]
03772bac6ed5bfe75bc0ad4d2eab56fd
The first line contains three integers m, t, r (1 ≤ m, t, r ≤ 300), representing the number of ghosts to visit Anya, the duration of a candle's burning and the minimum number of candles that should burn during each visit. The next line contains m space-separated numbers wi (1 ≤ i ≤ m, 1 ≤ wi ≤ 300), the i-th of them r...
1,600
If it is possible to make at least r candles burn during each visit, then print the minimum number of candles that Anya needs to light for that. If that is impossible, print  - 1.
standard output
PASSED
e83b8841acaeb6ec59cab70160e8aa05
train_000.jsonl
1495958700
Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message...
256 megabytes
import static java.lang.Math.* ; import static java.util.Arrays.* ; import java.math.BigInteger; import java.util.*; import java.io.*; public class Main { void main() throws Exception { Scanner sc = new Scanner(System.in) ; PrintWriter out = new PrintWriter(System.out) ; int TC = sc.n...
Java
["4\naa\nabcd\nccc\nabcc"]
5 seconds
["5\n10\n14\n12"]
NoteA string s contains another string p as a substring if p is a contiguous subsequence of s. For example, ab is a substring of cab but not of acb.
Java 8
standard input
[ "string suffix structures" ]
a9c5516f0430f01d2d000241e5ac69ed
The input starts with a line indicating the number of test cases T (1 ≤ T ≤ 10). After that, T test cases follow, each of which consists of one line containing a string s (1 ≤ |s| ≤ 100 000) composed of lowercase letters (a-z).
2,300
Output T lines, every line containing one number – the answer to the corresponding test case.
standard output
PASSED
4db4f21edcdbc6fc6eedf0737a055a2c
train_000.jsonl
1495958700
Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message...
256 megabytes
import java.math.BigInteger; import java.util.*; import java.io.*; public class Main { public static InputReader in = new InputReader(System.in); public static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); public static void main(String[] args) { int a; String...
Java
["4\naa\nabcd\nccc\nabcc"]
5 seconds
["5\n10\n14\n12"]
NoteA string s contains another string p as a substring if p is a contiguous subsequence of s. For example, ab is a substring of cab but not of acb.
Java 8
standard input
[ "string suffix structures" ]
a9c5516f0430f01d2d000241e5ac69ed
The input starts with a line indicating the number of test cases T (1 ≤ T ≤ 10). After that, T test cases follow, each of which consists of one line containing a string s (1 ≤ |s| ≤ 100 000) composed of lowercase letters (a-z).
2,300
Output T lines, every line containing one number – the answer to the corresponding test case.
standard output
PASSED
6d5e77063b2b56eba66536b3ff5be29c
train_000.jsonl
1495958700
Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import...
Java
["4\naa\nabcd\nccc\nabcc"]
5 seconds
["5\n10\n14\n12"]
NoteA string s contains another string p as a substring if p is a contiguous subsequence of s. For example, ab is a substring of cab but not of acb.
Java 8
standard input
[ "string suffix structures" ]
a9c5516f0430f01d2d000241e5ac69ed
The input starts with a line indicating the number of test cases T (1 ≤ T ≤ 10). After that, T test cases follow, each of which consists of one line containing a string s (1 ≤ |s| ≤ 100 000) composed of lowercase letters (a-z).
2,300
Output T lines, every line containing one number – the answer to the corresponding test case.
standard output
PASSED
3912853d1e5d324a1dec527e00e1b8e7
train_000.jsonl
1495958700
Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class CF802I { final int ALPHA = 26; final int OFFSET = 'a'; int next, MAX, last, len[], link[], trie[][]; long[] dp; boolean[] terminal; void suffixAutomaton(char[] s) { MAX = s.length << 1; next = 1; last = 0; len = new int[MAX]; link = ...
Java
["4\naa\nabcd\nccc\nabcc"]
5 seconds
["5\n10\n14\n12"]
NoteA string s contains another string p as a substring if p is a contiguous subsequence of s. For example, ab is a substring of cab but not of acb.
Java 8
standard input
[ "string suffix structures" ]
a9c5516f0430f01d2d000241e5ac69ed
The input starts with a line indicating the number of test cases T (1 ≤ T ≤ 10). After that, T test cases follow, each of which consists of one line containing a string s (1 ≤ |s| ≤ 100 000) composed of lowercase letters (a-z).
2,300
Output T lines, every line containing one number – the answer to the corresponding test case.
standard output
PASSED
1ff08e71b628ae96fe5ef35a96fe1c46
train_000.jsonl
1495958700
Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message...
256 megabytes
//Created by Aminul on 9/3/2019. import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import static java.lang.Math.max; public class CF802I { public static void main(String[] args) throws Exception { //Scanner in = new Scanner(System.in); ...
Java
["4\naa\nabcd\nccc\nabcc"]
5 seconds
["5\n10\n14\n12"]
NoteA string s contains another string p as a substring if p is a contiguous subsequence of s. For example, ab is a substring of cab but not of acb.
Java 8
standard input
[ "string suffix structures" ]
a9c5516f0430f01d2d000241e5ac69ed
The input starts with a line indicating the number of test cases T (1 ≤ T ≤ 10). After that, T test cases follow, each of which consists of one line containing a string s (1 ≤ |s| ≤ 100 000) composed of lowercase letters (a-z).
2,300
Output T lines, every line containing one number – the answer to the corresponding test case.
standard output
PASSED
f955fc722a0b19a77c2baa614a2bb58a
train_000.jsonl
1495958700
Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message...
256 megabytes
//Created by Aminul on 9/3/2019. import java.io.*; import java.util.*; import static java.lang.Math.max; public class CF802I_fast { public static void main(String[] args) throws Exception { FastReader in = new FastReader(System.in); PrintWriter pw = new PrintWriter(System.out); SuffixArra...
Java
["4\naa\nabcd\nccc\nabcc"]
5 seconds
["5\n10\n14\n12"]
NoteA string s contains another string p as a substring if p is a contiguous subsequence of s. For example, ab is a substring of cab but not of acb.
Java 8
standard input
[ "string suffix structures" ]
a9c5516f0430f01d2d000241e5ac69ed
The input starts with a line indicating the number of test cases T (1 ≤ T ≤ 10). After that, T test cases follow, each of which consists of one line containing a string s (1 ≤ |s| ≤ 100 000) composed of lowercase letters (a-z).
2,300
Output T lines, every line containing one number – the answer to the corresponding test case.
standard output
PASSED
b47120ad059a4178bb24428d451673e4
train_000.jsonl
1495958700
Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message...
256 megabytes
//Created by Aminul on 9/3/2019. import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import static java.lang.Math.max; public class CF802I { public static void main(String[] args) throws Exception { //Scanner in = new Scanner(System.in); ...
Java
["4\naa\nabcd\nccc\nabcc"]
5 seconds
["5\n10\n14\n12"]
NoteA string s contains another string p as a substring if p is a contiguous subsequence of s. For example, ab is a substring of cab but not of acb.
Java 8
standard input
[ "string suffix structures" ]
a9c5516f0430f01d2d000241e5ac69ed
The input starts with a line indicating the number of test cases T (1 ≤ T ≤ 10). After that, T test cases follow, each of which consists of one line containing a string s (1 ≤ |s| ≤ 100 000) composed of lowercase letters (a-z).
2,300
Output T lines, every line containing one number – the answer to the corresponding test case.
standard output
PASSED
4fca6144aee8b028af6179b76d984a94
train_000.jsonl
1495958700
Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message...
256 megabytes
//Created by Aminul on 9/3/2019. import java.io.*; import java.util.*; import static java.lang.Math.max; public class CF802I_fast { public static void main(String[] args) throws Exception { FastReader in = new FastReader(System.in); PrintWriter pw = new PrintWriter(System.out); int test =...
Java
["4\naa\nabcd\nccc\nabcc"]
5 seconds
["5\n10\n14\n12"]
NoteA string s contains another string p as a substring if p is a contiguous subsequence of s. For example, ab is a substring of cab but not of acb.
Java 8
standard input
[ "string suffix structures" ]
a9c5516f0430f01d2d000241e5ac69ed
The input starts with a line indicating the number of test cases T (1 ≤ T ≤ 10). After that, T test cases follow, each of which consists of one line containing a string s (1 ≤ |s| ≤ 100 000) composed of lowercase letters (a-z).
2,300
Output T lines, every line containing one number – the answer to the corresponding test case.
standard output
PASSED
17f518e8a7d76fea68c0bf3449646161
train_000.jsonl
1495958700
Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia messages and she is now trying to measure the self-similarity of the message...
256 megabytes
import java.math.BigInteger; import java.util.*; import java.io.*; public class Main { public static InputReader in = new InputReader(System.in); public static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); public static void main(String[] args) { int a; String...
Java
["4\naa\nabcd\nccc\nabcc"]
5 seconds
["5\n10\n14\n12"]
NoteA string s contains another string p as a substring if p is a contiguous subsequence of s. For example, ab is a substring of cab but not of acb.
Java 8
standard input
[ "string suffix structures" ]
a9c5516f0430f01d2d000241e5ac69ed
The input starts with a line indicating the number of test cases T (1 ≤ T ≤ 10). After that, T test cases follow, each of which consists of one line containing a string s (1 ≤ |s| ≤ 100 000) composed of lowercase letters (a-z).
2,300
Output T lines, every line containing one number – the answer to the corresponding test case.
standard output
PASSED
d6fab0d787501d6d60973dcdf7496830
train_000.jsonl
1526395500
You work in a big office. It is a 9 floor building with an elevator that can accommodate up to 4 people. It is your responsibility to manage this elevator.Today you are late, so there are queues on some floors already. For each person you know the floor where he currently is and the floor he wants to reach. Also, you k...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); Task...
Java
["2\n3 5\n5 3", "2\n5 3\n3 5"]
3 seconds
["10", "12"]
Note Explaination for the first sample t = 0 t = 2 t = 3 t = 5 t = 6 t = 7 t = 9 t = 10
Java 8
standard input
[ "dp", "graphs", "shortest paths" ]
f6be5319ad3733d07a8ffd089fc44c71
The first line contains an integer n (1 ≤ n ≤ 2000) — the number of employees. The i-th of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 9, ai ≠ bi) — the floor on which an employee initially is, and the floor he wants to reach. The employees are given in the order they came to the elevator.
2,400
Print a single integer — the minimal possible time in seconds.
standard output
PASSED
e5c61a33d879c9c1e98a0f979f36fcc9
train_000.jsonl
1526395500
You work in a big office. It is a 9 floor building with an elevator that can accommodate up to 4 people. It is your responsibility to manage this elevator.Today you are late, so there are queues on some floors already. For each person you know the floor where he currently is and the floor he wants to reach. Also, you k...
256 megabytes
import java.util.*; import java.io.*; public class P983C { public static void main(String[] args) { FastScanner in = new FastScanner(System.in); int n = in.nextInt(); int[][][] dp = new int[2][10000][10]; for (int[][] d : dp) for (int[] arr : d) Arrays.fill(arr, Integer.MAX_VALUE); dp[0][0][1] = 0; ...
Java
["2\n3 5\n5 3", "2\n5 3\n3 5"]
3 seconds
["10", "12"]
Note Explaination for the first sample t = 0 t = 2 t = 3 t = 5 t = 6 t = 7 t = 9 t = 10
Java 8
standard input
[ "dp", "graphs", "shortest paths" ]
f6be5319ad3733d07a8ffd089fc44c71
The first line contains an integer n (1 ≤ n ≤ 2000) — the number of employees. The i-th of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 9, ai ≠ bi) — the floor on which an employee initially is, and the floor he wants to reach. The employees are given in the order they came to the elevator.
2,400
Print a single integer — the minimal possible time in seconds.
standard output