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
7ae3982e57da2765c6fa0e560ba3c2d7
train_000.jsonl
1448636400
You are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class A { static MyScanner in = new MyScanner(); static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringToke...
Java
["5 4\n1 3 5 7 9\n6 4 2 8", "5 5\n1 2 1 2 5\n3 1 4 1 5"]
2 seconds
["3 2 1 4", "4 2 4 2 5"]
null
Java 11
standard input
[ "data structures", "two pointers", "binary search", "sortings" ]
e9a519be33f25c828bae787330c18dd4
The first line contains two integers n, m (1 ≀ n, m ≀ 2Β·105) β€” the sizes of arrays a and b. The second line contains n integers β€” the elements of array a ( - 109 ≀ ai ≀ 109). The third line contains m integers β€” the elements of array b ( - 109 ≀ bj ≀ 109).
1,300
Print m integers, separated by spaces: the j-th of which is equal to the number of such elements in array a that are less than or equal to the value bj.
standard output
PASSED
6b889e13310beed9ff29b12000644c97
train_000.jsonl
1448636400
You are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.
256 megabytes
import java.util.PriorityQueue; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] arr1 = new int[n]; int[] arr2 = new int[m]; for (int i = ...
Java
["5 4\n1 3 5 7 9\n6 4 2 8", "5 5\n1 2 1 2 5\n3 1 4 1 5"]
2 seconds
["3 2 1 4", "4 2 4 2 5"]
null
Java 11
standard input
[ "data structures", "two pointers", "binary search", "sortings" ]
e9a519be33f25c828bae787330c18dd4
The first line contains two integers n, m (1 ≀ n, m ≀ 2Β·105) β€” the sizes of arrays a and b. The second line contains n integers β€” the elements of array a ( - 109 ≀ ai ≀ 109). The third line contains m integers β€” the elements of array b ( - 109 ≀ bj ≀ 109).
1,300
Print m integers, separated by spaces: the j-th of which is equal to the number of such elements in array a that are less than or equal to the value bj.
standard output
PASSED
7c81eaa3751d883713fa71094e07ef69
train_000.jsonl
1448636400
You are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.
256 megabytes
import java.util.Arrays; import java.util.PriorityQueue; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int[] arr1 = new int[n]; int[] arr2 = new int[...
Java
["5 4\n1 3 5 7 9\n6 4 2 8", "5 5\n1 2 1 2 5\n3 1 4 1 5"]
2 seconds
["3 2 1 4", "4 2 4 2 5"]
null
Java 11
standard input
[ "data structures", "two pointers", "binary search", "sortings" ]
e9a519be33f25c828bae787330c18dd4
The first line contains two integers n, m (1 ≀ n, m ≀ 2Β·105) β€” the sizes of arrays a and b. The second line contains n integers β€” the elements of array a ( - 109 ≀ ai ≀ 109). The third line contains m integers β€” the elements of array b ( - 109 ≀ bj ≀ 109).
1,300
Print m integers, separated by spaces: the j-th of which is equal to the number of such elements in array a that are less than or equal to the value bj.
standard output
PASSED
01e2c813cbd2e14fecd9b3cf05f4c68e
train_000.jsonl
1448636400
You are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.
256 megabytes
import java.util.*; import java.io.*; public class Main { static long mod=(long)(1e9+7); static double PI=3.1415926535; public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw=new PrintWriter(new Buff...
Java
["5 4\n1 3 5 7 9\n6 4 2 8", "5 5\n1 2 1 2 5\n3 1 4 1 5"]
2 seconds
["3 2 1 4", "4 2 4 2 5"]
null
Java 11
standard input
[ "data structures", "two pointers", "binary search", "sortings" ]
e9a519be33f25c828bae787330c18dd4
The first line contains two integers n, m (1 ≀ n, m ≀ 2Β·105) β€” the sizes of arrays a and b. The second line contains n integers β€” the elements of array a ( - 109 ≀ ai ≀ 109). The third line contains m integers β€” the elements of array b ( - 109 ≀ bj ≀ 109).
1,300
Print m integers, separated by spaces: the j-th of which is equal to the number of such elements in array a that are less than or equal to the value bj.
standard output
PASSED
ea43fcf62776c90fa912ca6d03f04618
train_000.jsonl
1448636400
You are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal to the value bj.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.UncheckedIOException; import java.lang.reflect.Array; import java.util.ArrayDeque; import java.util.Arrays; import java.util.Deque; import java.util.List; import java.util.Objects; im...
Java
["5 4\n1 3 5 7 9\n6 4 2 8", "5 5\n1 2 1 2 5\n3 1 4 1 5"]
2 seconds
["3 2 1 4", "4 2 4 2 5"]
null
Java 11
standard input
[ "data structures", "two pointers", "binary search", "sortings" ]
e9a519be33f25c828bae787330c18dd4
The first line contains two integers n, m (1 ≀ n, m ≀ 2Β·105) β€” the sizes of arrays a and b. The second line contains n integers β€” the elements of array a ( - 109 ≀ ai ≀ 109). The third line contains m integers β€” the elements of array b ( - 109 ≀ bj ≀ 109).
1,300
Print m integers, separated by spaces: the j-th of which is equal to the number of such elements in array a that are less than or equal to the value bj.
standard output
PASSED
5adc0e59b0777302ba71e5c2bfe781ac
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.util.*; public class test { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String line1 = keyboard.nextLine(); String line2 = keyboard.nextLine(); if (line1.equals(line2)) System.out.println(-1); else System.out.println(Math.max(line1.length(), line2.len...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
831ebdca8fc961fa3514d1319503a8b4
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.util.*; import java.lang.String; public class first{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s1=sc.nextLine(); String s2=sc.nextLine(); int l1=s1.length(); int l2=s2.length(); if(s1.compareTo(s2)==0){ ...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
1ccfc0fa07b6dd935ccc92131618bcbb
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class A { public static void main(String[] args) throws Throwable { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); String a=in.readLine(); String b=in.readLine(); if(a.equals(b)) { System.out.println(-1); } ...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
fbc4c08b171692048751ee5b05132e6a
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class A { public static void main(String[] args) throws Throwable { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); String a=in.readLine(); String b=in.readLine(); if(a.equals(b)) { int i=0; for(;i<a.length()...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
00fada19349e87600bcc9083c2659f25
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class CFA { static String max, min ; public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for(String ln;(ln=in.readLine())!=null;){ String a = ln; String b...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
d89c5ef07d1b3b97f68dbc89327f39d7
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class A { static String a, b; public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); a = in.readLine(); b = in.readLine(); int asw = 0; if (a.length() != b.l...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
0f5d98c2bc197db22e40ffaca5849858
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.util.*; public class Codeforces4 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); String a = sc.next(); String b = sc.next(); if(a.equals(b)){ System.out.println("-1"); }else { ...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
419258003171ccb03b1448eb00a4eba5
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.util.Scanner; public class GfG{ public static void main(String[] args){ Scanner sc=new Scanner (System.in); String s=sc.next(); String s1=sc.next(); if(s.equals(s1)){ System.out.println("-1"); } else{ System.out.println(s.length()>s...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
92e7537428e3945c82f2e0d678515ec5
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.util.*; import java.lang.Math; import java.util.Arrays; import java.util.Scanner; import java.util.stream.IntStream; import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; public class Problem { ...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
8cea74d714e7b4ab1ca90e30c2565a14
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.io.*; public class Main { public static void main(String args[])throws IOException { BufferedReader obj=new BufferedReader(new InputStreamReader(System.in)); String a=obj.readLine(); String b=obj.readLine(); //int dp[][]=new int[a.length()+1][b.length()+1]; //for(int i=1;i<=a.length();i++) //{ // for...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
f37ef1866c3680bbced4b973d74ef9ea
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s1=in.next(); String s2=in.next(); if(s1.equals(s2)) System.out.println(-1); else System.ou...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
bb709882bdc0e26b05252bd7d0d3c31c
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.util.*; public class Test{ public static void main(String args[]) throws Exception { Scanner st=new Scanner(System.in); String s1=st.next().trim(); String s2=st.next().trim(); if(s1.equals(s2)){ System.out.println("-1"); }else{ System.out.print...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
ebb3c9a9aa9de09b05bbdf4ae5bfa429
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
//package excerciseA; import java.io.Console; import java.util.Scanner; public class aExcercise { public static void main(String[] args){ Scanner input = new Scanner(System.in); String a = input.nextLine(); String b = input.nextLine(); while(true){ if(a.isEmpty() || b.isEmpty()){ System.out.print...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
edd9410660ab3a6f1c225ef8bee8ac75
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
//package excerciseA; import java.io.Console; import java.util.Scanner; public class aExcercise { public static void main(String[] args){ Scanner input = new Scanner(System.in); String a = input.nextLine(); String b = input.nextLine(); while(true){ if(a.isEmpty() || b.isEmpty()){ System.out.print...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
82746a7d02dfcce5c9c23435b23e8ad3
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
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. */ //package acm; import java.util.*; import java.io.*; import java.util.Scanner; import java.io.IOException; /** * * @author bro2 */ ...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
2979f69bc59a1c0a0ce7615ad7054164
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class MahmoudLongestUncommonSubsequence { public static PrintWriter out = new PrintWriter(System.out); public static Scanner in = new Scanner(System.in); public static void main(String[] args) { // int t = ni(); ...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
151c99218a89562972aefd89dddcc492
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class MahmoudLongestUncommonSubsequence { public static PrintWriter out = new PrintWriter(System.out); public static Scanner in = new Scanner(System.in); public static void main(String[] args) { // int t = ni(); ...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
ccb8908334430c63bfc4c555f1e8fd49
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class a { Scanner sc; PrintWriter out; void solve(){ //Enter code here utkarsh String a,b; a=sc.next(); b=sc.next(); if(a.compareTo(b)==0){ out.println("-1"); }else{ ...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
c30d184705c072f7834db87da936456a
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * @author MiloMurphy */ public class LUCS { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new Buf...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
94eb670782f758e50ae6eeb81cc2efbd
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); String a,b; a=input.next(); b=input.next(); if(a.equals(b)) System.out.println(-1); else if(a.length()>b.length()) ...
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
a1b758848e43da8b832e984205309e12
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.util.*; public class Test { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s1 = in.next(); String s2 = in.next(); System.out.println(s1.equals(s2) ? -1 : Math.max(s1.length(), s2.length())); } }
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
4869bf6d3e77b04b52ade9f61882407a
train_000.jsonl
1486487100
While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.Given two strings a and b, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one...
256 megabytes
import java.util.*; public class Sub { public static void main(String[] args) { Scanner in = new Scanner(System.in); String a = in.next(); String b = in.next(); System.out.println(a.equals(b) ? -1 : Math.max(a.length(), b.length())); } }
Java
["abcd\ndefgh", "a\na"]
2 seconds
["5", "-1"]
NoteIn the first example: you can choose "defgh" from string b as it is the longest subsequence of string b that doesn't appear as a subsequence of string a.
Java 8
standard input
[ "constructive algorithms", "strings" ]
f288d7dc8cfcf3c414232a1b1fcdff3e
The first line contains string a, and the second lineΒ β€” string b. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 105 characters.
1,000
If there's no uncommon subsequence, print "-1". Otherwise print the length of the longest uncommon subsequence of a and b.
standard output
PASSED
fad9f65330e44fc349f668ca029e706f
train_000.jsonl
1552035900
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
512 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { PrintWriter out = new PrintWriter(System.out); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tok = new StringTokenizer(""); String next() throws IOException { if (!tok.hasMoreToke...
Java
["101101\n110", "10010110\n100011", "10\n11100"]
1 second
["110110", "01100011", "01"]
NoteIn the first example there are two occurrences, one starting from first position and one starting from fourth position.In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last pos...
Java 8
standard input
[ "hashing", "string suffix structures", "greedy", "strings" ]
6ac00fcd4a483f9f446e692d05fd31a4
The first line contains string $$$s$$$ ($$$1 \leqslant |s| \leqslant 500\,000$$$), denoting the current project of the camp's schedule. The second line contains string $$$t$$$ ($$$1 \leqslant |t| \leqslant 500\,000$$$), denoting the optimal schedule according to Gleb. Strings $$$s$$$ and $$$t$$$ contain characters '0' ...
1,600
In the only line print the schedule having the largest number of substrings equal to $$$t$$$. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in $$$s$$$ and the number of ones should be equal to the number of ones in $$$s$$$. In case there mu...
standard output
PASSED
fb0d8f3fa4d8ee9a99c6c3ae3588487b
train_000.jsonl
1552035900
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
512 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; import java.util.HashMap; import java.util.HashSet; import java.util.Random; import java...
Java
["101101\n110", "10010110\n100011", "10\n11100"]
1 second
["110110", "01100011", "01"]
NoteIn the first example there are two occurrences, one starting from first position and one starting from fourth position.In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last pos...
Java 8
standard input
[ "hashing", "string suffix structures", "greedy", "strings" ]
6ac00fcd4a483f9f446e692d05fd31a4
The first line contains string $$$s$$$ ($$$1 \leqslant |s| \leqslant 500\,000$$$), denoting the current project of the camp's schedule. The second line contains string $$$t$$$ ($$$1 \leqslant |t| \leqslant 500\,000$$$), denoting the optimal schedule according to Gleb. Strings $$$s$$$ and $$$t$$$ contain characters '0' ...
1,600
In the only line print the schedule having the largest number of substrings equal to $$$t$$$. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in $$$s$$$ and the number of ones should be equal to the number of ones in $$$s$$$. In case there mu...
standard output
PASSED
e3024783f33a85ebf97bf8ef8f98d038
train_000.jsonl
1552035900
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
512 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; import java.util.HashMap; import java.util.HashSet; import java.util.Random; import java...
Java
["101101\n110", "10010110\n100011", "10\n11100"]
1 second
["110110", "01100011", "01"]
NoteIn the first example there are two occurrences, one starting from first position and one starting from fourth position.In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last pos...
Java 8
standard input
[ "hashing", "string suffix structures", "greedy", "strings" ]
6ac00fcd4a483f9f446e692d05fd31a4
The first line contains string $$$s$$$ ($$$1 \leqslant |s| \leqslant 500\,000$$$), denoting the current project of the camp's schedule. The second line contains string $$$t$$$ ($$$1 \leqslant |t| \leqslant 500\,000$$$), denoting the optimal schedule according to Gleb. Strings $$$s$$$ and $$$t$$$ contain characters '0' ...
1,600
In the only line print the schedule having the largest number of substrings equal to $$$t$$$. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in $$$s$$$ and the number of ones should be equal to the number of ones in $$$s$$$. In case there mu...
standard output
PASSED
d0da0da0fe218530d5172ca8a9fcbb6a
train_000.jsonl
1552035900
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
512 megabytes
import java.io.*; import java.util.*; public class D_CampSchedule { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader inp = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); ...
Java
["101101\n110", "10010110\n100011", "10\n11100"]
1 second
["110110", "01100011", "01"]
NoteIn the first example there are two occurrences, one starting from first position and one starting from fourth position.In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last pos...
Java 8
standard input
[ "hashing", "string suffix structures", "greedy", "strings" ]
6ac00fcd4a483f9f446e692d05fd31a4
The first line contains string $$$s$$$ ($$$1 \leqslant |s| \leqslant 500\,000$$$), denoting the current project of the camp's schedule. The second line contains string $$$t$$$ ($$$1 \leqslant |t| \leqslant 500\,000$$$), denoting the optimal schedule according to Gleb. Strings $$$s$$$ and $$$t$$$ contain characters '0' ...
1,600
In the only line print the schedule having the largest number of substrings equal to $$$t$$$. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in $$$s$$$ and the number of ones should be equal to the number of ones in $$$s$$$. In case there mu...
standard output
PASSED
f29b783b7d9398a03eb7ca919d8ffe16
train_000.jsonl
1552035900
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class D { int[] funcZ(String two){ int[] z = new int[two.length()]; int l = 0; ...
Java
["101101\n110", "10010110\n100011", "10\n11100"]
1 second
["110110", "01100011", "01"]
NoteIn the first example there are two occurrences, one starting from first position and one starting from fourth position.In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last pos...
Java 8
standard input
[ "hashing", "string suffix structures", "greedy", "strings" ]
6ac00fcd4a483f9f446e692d05fd31a4
The first line contains string $$$s$$$ ($$$1 \leqslant |s| \leqslant 500\,000$$$), denoting the current project of the camp's schedule. The second line contains string $$$t$$$ ($$$1 \leqslant |t| \leqslant 500\,000$$$), denoting the optimal schedule according to Gleb. Strings $$$s$$$ and $$$t$$$ contain characters '0' ...
1,600
In the only line print the schedule having the largest number of substrings equal to $$$t$$$. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in $$$s$$$ and the number of ones should be equal to the number of ones in $$$s$$$. In case there mu...
standard output
PASSED
e706a825078185e6162fe05159eba1aa
train_000.jsonl
1552035900
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
512 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class CF1138D { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); char[] s = br.readLine().toCharArray(); char[] t = br.readLine().t...
Java
["101101\n110", "10010110\n100011", "10\n11100"]
1 second
["110110", "01100011", "01"]
NoteIn the first example there are two occurrences, one starting from first position and one starting from fourth position.In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last pos...
Java 8
standard input
[ "hashing", "string suffix structures", "greedy", "strings" ]
6ac00fcd4a483f9f446e692d05fd31a4
The first line contains string $$$s$$$ ($$$1 \leqslant |s| \leqslant 500\,000$$$), denoting the current project of the camp's schedule. The second line contains string $$$t$$$ ($$$1 \leqslant |t| \leqslant 500\,000$$$), denoting the optimal schedule according to Gleb. Strings $$$s$$$ and $$$t$$$ contain characters '0' ...
1,600
In the only line print the schedule having the largest number of substrings equal to $$$t$$$. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in $$$s$$$ and the number of ones should be equal to the number of ones in $$$s$$$. In case there mu...
standard output
PASSED
29baf28ad69414fb8007a5c34e161077
train_000.jsonl
1552035900
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
512 megabytes
import java.io.IOException; import java.io.PrintWriter; import java.util.NoSuchElementException; public class Main{ public static void main(String[] args){ FastScanner sc = new FastScanner(); String S = sc.next(); String T = sc.next(); PrintWriter out = new PrintWriter(System.out); int o = overlap(T,T); ...
Java
["101101\n110", "10010110\n100011", "10\n11100"]
1 second
["110110", "01100011", "01"]
NoteIn the first example there are two occurrences, one starting from first position and one starting from fourth position.In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last pos...
Java 8
standard input
[ "hashing", "string suffix structures", "greedy", "strings" ]
6ac00fcd4a483f9f446e692d05fd31a4
The first line contains string $$$s$$$ ($$$1 \leqslant |s| \leqslant 500\,000$$$), denoting the current project of the camp's schedule. The second line contains string $$$t$$$ ($$$1 \leqslant |t| \leqslant 500\,000$$$), denoting the optimal schedule according to Gleb. Strings $$$s$$$ and $$$t$$$ contain characters '0' ...
1,600
In the only line print the schedule having the largest number of substrings equal to $$$t$$$. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in $$$s$$$ and the number of ones should be equal to the number of ones in $$$s$$$. In case there mu...
standard output
PASSED
ed8a03b28ea504a234ff947779aa0684
train_000.jsonl
1552035900
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
512 megabytes
import java.io.IOException; import java.util.InputMismatchException; public class Main { public static void main(String[] args) { FasterScanner sc = new FasterScanner(); char[] a1 = sc.nextString().toCharArray(); char[] a2 = sc.nextString().toCharArray(); int[] z = computeZArray(a2); int len = 0; for (...
Java
["101101\n110", "10010110\n100011", "10\n11100"]
1 second
["110110", "01100011", "01"]
NoteIn the first example there are two occurrences, one starting from first position and one starting from fourth position.In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last pos...
Java 8
standard input
[ "hashing", "string suffix structures", "greedy", "strings" ]
6ac00fcd4a483f9f446e692d05fd31a4
The first line contains string $$$s$$$ ($$$1 \leqslant |s| \leqslant 500\,000$$$), denoting the current project of the camp's schedule. The second line contains string $$$t$$$ ($$$1 \leqslant |t| \leqslant 500\,000$$$), denoting the optimal schedule according to Gleb. Strings $$$s$$$ and $$$t$$$ contain characters '0' ...
1,600
In the only line print the schedule having the largest number of substrings equal to $$$t$$$. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in $$$s$$$ and the number of ones should be equal to the number of ones in $$$s$$$. In case there mu...
standard output
PASSED
f5071785cb306f34ef8c9340d3190fb1
train_000.jsonl
1552035900
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
512 megabytes
import javafx.scene.layout.Priority; import java.io.*; import java.lang.reflect.Array; import java.net.Inet4Address; import java.util.*; import java.lang.*; import java.util.HashMap; import java.util.PriorityQueue; public class templ implements Runnable{ static class pair implements Comparable { int f; ...
Java
["101101\n110", "10010110\n100011", "10\n11100"]
1 second
["110110", "01100011", "01"]
NoteIn the first example there are two occurrences, one starting from first position and one starting from fourth position.In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last pos...
Java 8
standard input
[ "hashing", "string suffix structures", "greedy", "strings" ]
6ac00fcd4a483f9f446e692d05fd31a4
The first line contains string $$$s$$$ ($$$1 \leqslant |s| \leqslant 500\,000$$$), denoting the current project of the camp's schedule. The second line contains string $$$t$$$ ($$$1 \leqslant |t| \leqslant 500\,000$$$), denoting the optimal schedule according to Gleb. Strings $$$s$$$ and $$$t$$$ contain characters '0' ...
1,600
In the only line print the schedule having the largest number of substrings equal to $$$t$$$. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in $$$s$$$ and the number of ones should be equal to the number of ones in $$$s$$$. In case there mu...
standard output
PASSED
cc99d661c0cff428aa8903a532647cd3
train_000.jsonl
1552035900
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
512 megabytes
import java.lang.*; import java.math.*; import java.util.*; import java.io.*; public class Main { void solve(){ s=ns().toCharArray(); t=ns().toCharArray(); computeLPS(); int n=t.length; int c1[]=new int[2]; int c2[]=new int[2]; for(char ch : s) c1[ch-'0']++; ...
Java
["101101\n110", "10010110\n100011", "10\n11100"]
1 second
["110110", "01100011", "01"]
NoteIn the first example there are two occurrences, one starting from first position and one starting from fourth position.In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last pos...
Java 8
standard input
[ "hashing", "string suffix structures", "greedy", "strings" ]
6ac00fcd4a483f9f446e692d05fd31a4
The first line contains string $$$s$$$ ($$$1 \leqslant |s| \leqslant 500\,000$$$), denoting the current project of the camp's schedule. The second line contains string $$$t$$$ ($$$1 \leqslant |t| \leqslant 500\,000$$$), denoting the optimal schedule according to Gleb. Strings $$$s$$$ and $$$t$$$ contain characters '0' ...
1,600
In the only line print the schedule having the largest number of substrings equal to $$$t$$$. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in $$$s$$$ and the number of ones should be equal to the number of ones in $$$s$$$. In case there mu...
standard output
PASSED
d5dad8843199fb16ad806c905ef04b7c
train_000.jsonl
1552035900
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class TaskD { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); String t = br.re...
Java
["101101\n110", "10010110\n100011", "10\n11100"]
1 second
["110110", "01100011", "01"]
NoteIn the first example there are two occurrences, one starting from first position and one starting from fourth position.In the second example there is only one occurrence, which starts from third position. Note, that the answer is not unique. For example, if we move the first day (which is a day off) to the last pos...
Java 8
standard input
[ "hashing", "string suffix structures", "greedy", "strings" ]
6ac00fcd4a483f9f446e692d05fd31a4
The first line contains string $$$s$$$ ($$$1 \leqslant |s| \leqslant 500\,000$$$), denoting the current project of the camp's schedule. The second line contains string $$$t$$$ ($$$1 \leqslant |t| \leqslant 500\,000$$$), denoting the optimal schedule according to Gleb. Strings $$$s$$$ and $$$t$$$ contain characters '0' ...
1,600
In the only line print the schedule having the largest number of substrings equal to $$$t$$$. Printed schedule should consist of characters '0' and '1' only and the number of zeros should be equal to the number of zeros in $$$s$$$ and the number of ones should be equal to the number of ones in $$$s$$$. In case there mu...
standard output
PASSED
c6e1b830eecb1a9087d514c1dde5cf9b
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { Scanner scan=new Scanner(System.in); Strin...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
db67a5550cfdc61527ce65d44c17c40d
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import static java.util.Arrays.fill; import static java.lang.Math.*; import static java.util.Arrays.sort; import static java.util.Collections.sort; public class E931 { public static int mod = 1000000007; public static long INF = (1L << 60); static FastS...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
2031d6fe378db133dfd946dd9d87c1cf
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
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.ArrayList; import java.io.Writer; import java.io.OutputStream...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
c46a45b7f81464892023396beaa87977
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.Writer; import java.io.BufferedReader; ...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
8d143ca4fb589db806e615c21d6a5b11
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class ProblemE { private static class Node{ Node[] c; short childrenCount; Node(){ c = new Node[26]; childrenCount = 0; } } private static class Trie{ Node root; Trie(){ ...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
f3f62c05c8b052d3b7b72a75e76893c3
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class ProblemE { public static void main(String[] args)throws IOException{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); char[] chars = reader.readLine().toCharArray(); ...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
b397d758db7a6ea942bd5f8a65a773cf
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; /** * @author Don Li */ public class GameWithString { void solve() { char[] s = in.nextToken().toCharArray(); int n =...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
2b2622adf8adc0a83a858e8d5e130ce4
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.util.*; import java.io.*; import java.text.DecimalFormat; public class E { static final boolean stdin = true; static final String filename = ""; static FastScanner br; static PrintWriter pw; public static void main(String[] args) throws IOException { if (stdin) { br = new FastScanner(); pw ...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
6862a554682f2630e8526f4ecf924330
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.*; import java.util.*; public class CF931_D2_E{ public static void main(String[] args)throws Throwable { MyScanner sc=new MyScanner(); PrintWriter pw=new PrintWriter(System.out); String s=sc.next(); int n=s.length(); ArrayList<String> [] arr=new ArrayList [26]; for(int i=0;i<26;i++) ar...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
16a766d7fd9a01686d9cb192132bfaf5
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.util.*; import java.text.*; import java.io.*; import java.math.*; public class code5 { InputStream is; PrintWriter out; static long mod=pow(10,9)+7; static int dx[]={0,0,1,-1},dy[]={1,-1,0,0}; ArrayList<Integer> al[]; void solve() throws IOException { String s=ns(); int n=s.length(); s=s+s; i...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
17acda17d85b3507f6e453d18ed7b7bb
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { long MOD = 1000000007L; int INF = 1000000000; public class Obj implements Comparable<Obj>{ ...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
de710928b77aa0ee983d02bc3cdc0194
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Random; import java.util.TreeSet; public fi...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
c1f966d775ba043e0c84bcc791f5e9ee
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Random; import java.util.TreeSet; public fi...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
363aef71cac0ebb95b8ef9ed1f98b69a
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Stream; public class E_468 { public static final long[] POWER2 = generatePOWER2()...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
922525a83fc9f339f26f0243cbad2195
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.*; import java.util.*; public class CF931_D2_E{ public static void main(String[] args)throws Throwable { MyScanner sc=new MyScanner(); PrintWriter pw=new PrintWriter(System.out); String s=sc.next(); int n=s.length(); ArrayList<String> [] arr=new ArrayList [26]; for(int i=0;i<26;i++) ar...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
9daff94ff96c14bb8b72919e6123f230
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Scanner; //http://codeforces.com/contest/931/problem/E public class GameWithString { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] s = sc.nextLine().toCharArray(); sc.close(); dou...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
f1fc8b0a3a1b80757d759c1ccee57c87
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.util.*; import java.io.*; public class E { public static class alw { ArrayList<Integer> al; int c; public alw() { al = new ArrayList<Integer>(); c = 0; } } public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(Syste...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
49db027f670c6968b3ed08d9383b48df
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
//package baobab; import java.io.*; import java.util.*; public class E { public static final boolean DEBUG_PRINTS = false; public static void main(String[] args) { Solver solver = new Solver(); } static class Solver { IO io; public Solver() { this.io = new IO();...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
fae4964cfce4b3d1ae6c909b00058393
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
//package com.company; import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { MyScanner sc = new MyScanner(System.in); PrintWriter pw = new PrintWriter(System.out); // long st = System.currentTimeMillis(); Tanks.solve(sc...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
ce406bd7cf1d9f1c729fa27960a41b50
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.*; import java.util.*; public class R468_E { static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st = new StringTokenizer(""); public static void main(String[] args) throws Exception { String s = readString(); ArrayList<ArrayList<Int...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
ef704e58340ce3cdea7e74e3574f178f
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.StringTokenizer; public class codeforces { public static void main(String[] args) { FS scan =...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
6aa4f764576473278dad5678298fe8f2
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; /* public class _931E { } */ public class _931E { public void solve() throws FileNotFoundException { InputStream in...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
65cac38a715feebf35189deeb4a40d12
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class E { public static void main(String[] args) { Scanner input = new Scanner(); StringBuilder output = new StringBuilder(); String s = input.next(); int n = s.length(); int[][][] seen = new int[2...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
e215244af16ad77613299ca8e822cbc8
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class d { public ...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
21e42367340844c35bd6970ac1931f19
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int nu...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
fd3003c3991dff6e390848a3ce525c5d
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
// package cf931; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; import java.util.*; import java.util.function.Supplier; import java.util.stream.IntStream; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toMap;...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
b488f9737a2407d323fe13097086ba69
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; /* * * Comments Here * */ public class E000 { static BufferedReader br; static BufferedWriter bw; static StringTokenizer st; public static void main(String[] args) throws java.lang.Exception { br = new BufferedReader(new InputStreamReader(System...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
ab56429472182864467ce0e04c592ce4
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class R468_E { FastScanner in; PrintWriter out; public void solve() { String s = in.next(); int n = s.length(); ArrayList<Integer> a[] = new ArrayList[26]; for (int i = 0; i < 26; i++) { a[i] = new ArrayList<Integer>(); } for (int i ...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
bbcac45fe5981a1bd56e13a0f5c393a7
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.*; import java.util.*; import java.util.function.IntUnaryOperator; /** * gl hf */ public class Main { static class MyRunnable implements Runnable { @Override public void run() { } public void start() { } } static class Task { PrintWriter...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
b36e6f74650f42e3628f9042226e059d
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.*; import java.lang.*; import java.math.*; import java.util.*; public class E { public static void main(String[] args) { FastReader fr = new FastReader(); String str = fr.next(); int n = str.length(); ArrayList<ArrayList<Integer>> letterIndexes = new ArrayList<>(26); ...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
e800cf89a7c22be5690049545f662bc7
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.util.Scanner; import java.util.ArrayList; import java.lang.StringBuilder; public class test3 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); int l = s.length(); int[] ct = new int[26]; int[][] pos = new i...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
01b2f0de1c538b6ac657dc546e66aa2c
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class utkarsh { InputStream is; PrintWriter out; void solve(){ //Enter code here utkarsh char[] c = ns().toCharArray(); int n = c.length; ArrayList <Integer> a[] = new ArrayList[26]; for(int i = 0...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
d1575f1342466da80e0c750e7ec3a3fe
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.util.*; import java.io.*; public class Main { void solve(){ s=ns().toCharArray(); int n=s.length; char ss[]=(new String(s)+new String(s)).toCharArray(); int cnt[][][]=new int[26][26][n+1]; int cnt2[]=new int[26]; for(int i=0;i<n;i++) cnt2[s[i]-'a']++; ...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
0f0c36dc6e23b6929b732e867b560625
train_000.jsonl
1520177700
Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string s, consisting of small English letters, and uniformly at random chooses an integer k from a segment [0, len(s) - 1]. He tells Vasya this string s, and then shifts it k letters to the left, i.Β e. creates a new string ...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class cfs468E { public static void main(String[] args) { FastScanner sc = new FastScanner(); StringBuilder sb = new StringBuilder(); char[] letters = sc.next().toCharArray(); int n = letters.length; ...
Java
["technocup", "tictictactac", "bbaabaabbb"]
2 seconds
["1.000000000000000", "0.333333333333333", "0.100000000000000"]
NoteIn the first example Vasya can always open the second letter after opening the first letter, and the cyclic shift is always determined uniquely.In the second example if the first opened letter of t is "t" or "c", then Vasya can't guess the shift by opening only one other letter. On the other hand, if the first lett...
Java 8
standard input
[ "implementation", "probabilities", "math" ]
4c92218ccbab7d142c2cbb6dd54c510a
The only string contains the string s of length l (3 ≀ l ≀ 5000), consisting of small English letters only.
1,600
Print the only numberΒ β€” the answer for the problem. You answer is considered correct, if its absolute or relative error does not exceed 10 - 6. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
standard output
PASSED
b2dc48893c2dd6fe174e24e0a437584a
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.*; public class a { static long mod = 1000000009; static char[][] res; public static void main(String[] args) throws IOException { //Scanner input = new Scanner(new File("input.txt")); //PrintWriter out = new PrintWriter(new File("output.txt")); input.init(System.in)...
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 8
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
7ccd795777ea56e355642d65652115dd
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.*; public class Main implements Runnable { class Point{ int x, y; Point(int x, int y){ this.x = x; this.y = y; } } private int d(Point a, Point b){ retur...
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 8
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
e8bb53252ccb3e506bce5c331e011b08
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 static java.lang.Math.*; import static java.lang.System.currentTimeMillis; import static java.lang.System.exit; import static java.lang.System.arraycopy; import static java.util.Arrays.sort; import static java.util.Arrays.binarySearch; import static java.util.Arrays.fill; import java.util.*; import java.io.*; p...
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 8
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
4e196aa61b4ba64f89273c59a5b0872f
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.*; import java.util.Random; import java.util.StringTokenizer; public class Main { long b = 31; String fileName = ""; ////////////////////// SOLUTION SOLUTION SOLUTION ////////////////////////////// int INF = Integer.MAX_VALUE / 10; long MODULO = 1000*...
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 8
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
c89fbb48c36b045b2f835113bf483df7
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.Scanner; import java.util.StringTokenizer; public class RectSquare{ int[] x, y; public static void main(String[] args) { new RectSquare().run(); } public void run() { Scanner file = new Scanner(System.in); x = new int[8]; y = new...
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 8
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
c75ab416e1a2d14009b0daa11bf16254
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.*; import java.util.*; public class Main { //static final long MOD = 998244353; static final long MOD = 1000000007; static boolean[] visited; public static void main(String[] args) throws IOException { FastScanner sc=new FastScanner(); int[][] points = new in...
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 8
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
5b5e4207882de50d29f5f4cb0ee50d70
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 sample { static int[] x = new int[8]; static int[] y = new int[8]; static double eps = 1e-8; static boolean found = false; public static void main(String[] args) { Scanner in = new Scanner(System.in); for (int i = 0; i < 8; i++) { x[i] = in.nextInt(); y[i] = 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
35abfda590bb9000f56fff3904b7f4f2
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.math.*; public class Main{ static boolean checkCross(int x0, int x1, int x2, int x3, int y0, int y1, int y2, int y3){ int check = (x1 - x0) * (x3 - x2) + (y1 - y0) * (y3 - y2); return check == 0; } static boolean isSquare(int[] x, int[] y){ ...
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
4c71d14cac956c4416e406f33684a0b5
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.*; public class Main implements Runnable { private void solution() throws IOException { int[] x = new int[8]; int[] y = new int[8]; for (int i = 0; i < x.length; ++i) { x[i] = in.nextInt(); y[i] = in.nextInt(); } int resMask = -1; for...
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
5e8dd07c6707f1b88ea51cbbc30eb28e
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.ArrayList; import java.util.Scanner; public class TaskD { /** * @param args */ public static void main(String[] args) { TaskD task = new TaskD(); task.read(); task.write(); } boolean was[] = new boolean[8]; int perm[] =...
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
6c91c8579c213e7091abafa6355df8bf
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.geom.Line2D; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java....
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
b5cabac009f44bc7b8f3bc237e6a9eb6
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.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; import java.util.StringTokenizer; public class Main { public final FastScanner in; public final PrintWriter out; public Main(String mode) throws IOException { if (mode.equals("console")) { ...
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
51e9c2a26fc114da7d80b5e9a59feadd
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.util.*; public class D { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader r=new BufferedReader(new InputStreamReader(System.in)); Point[] points=new Point[8]; for (int i = 0; i < points.length;...
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
a98bf4b1ecee3d15a89bece9a65e4170
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
//package d; import java.util.*; import java.io.*; public class Main { public void run() throws Exception { Scanner in = new Scanner(System.in); int []x = new int[8]; int []y = new int[8]; for (int i = 0; i < 8; i++) { x[i] = in.nextInt(); y[i] = in.nextInt(); } int a[] = new int[8]; point p[] =...
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
39f2d56e78ff325e07b03d2061bf99b1
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.lang.*; import java.util.*; public class Main { public static int[] x = new int[8], y = new int[8]; public static int isRec(int[] p) { int i, j, k, l; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { for (k = 0; k < 4; k++) { for (...
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
4def78baf1e52f41fac49fbc072b403e
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.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; public class ProblemD implements Runnable{ long[] x=new long[8]; long[] y=new long[8]; public void solve() throws IOExcept...
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
397935b5d653d78741024c5c88b39a60
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.Scanner; public class D { static int[]x,y; static int[][] comb = {{0, 1, 2, 3}, {0, 2, 1, 3}, {0, 3, 1, 2}}; public static void main(String[] args) { Scanner sc = new Scanner(System.in); x = new int[9]; y = new int[9]; for (int ...
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
66010646de24719be0beec783736404c
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.StringTokenizer; public class D implements Runnable { class Point { int x, y; Point(int x, int y) { this.x = x; this.y = y; } } final int n = 8; boolean[] used; Point[] points; int[] p; ...
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
ce7659de44ea2493f7388458371cece0
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 D97 { public static P[] p = new P[8]; private static boolean storoniravni(int a, int b, int c) { int aa = (p[a].x - p[b].x)*(p[a].x - p[b].x) + (p[a].y - p[b].y)*(p[a].y - p[b].y); int bb = (p[b].x - p[c].x)*(p[b].x - p[c].x) + (p[b].y - p[c].y)*(p[b].y ...
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
45fd840066dafabc1256715a680561b1
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.*; public class a { static long mod = 1000000009; static char[][] res; public static void main(String[] args) throws IOException { //Scanner input = new Scanner(new File("input.txt")); //PrintWriter out = new PrintWriter(new File("output.txt")); input.init(System.in)...
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
ddaf6f23dbca4e6207ab04244ecda049
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.BufferedInputStream; import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class RectangleAndSquare { //Round #97 - Rectangle and Square public static void main(String[] args) { Scanner sc = new Scanner(new BufferedInputStream(System.in)); 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
4aa1b661b94c5d7598c5eec67af15645
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
//package beta97; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class D { public static BufferedReader br; public static StringTokenizer inp; public static PrintWriter out; static int x[], y[]; stat...
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
731712cd2069025425389fa8d661c5b7
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.HashMap; import java.util.Scanner; public class four { static int[] s; static int[] r; public static void main(String[] args) { Scanner sc = new Scanner(System.in); point[] points = new point[8]; HashMap<String, Integer> map = new HashMap<...
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
4c2ee59aa2cdf06b93ca9f0f692b6d24
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.*; public class C97D{ static BufferedReader br; public static void main(String args[])throws Exception{ br=new BufferedReader(new InputStreamReader(System.in)); Point p[]=new Point[8]; for(int i=0;i<8;i++){ int nm[]=toIntArray(); ...
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
05cbc1a8235d79e4b0e9bfc19bc03c95
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 { int order[] = new int[4]; private static boolean isSquare(int x[], int y[]) { String[] orders = { "0123", "0132", "0231" }; line[] lines = new line[4]; for (int i = 0; i < orders.length; i++) { lines[0] = new line(x[orders[i].char...
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
19ea38df6ccbcaf9242c56779396dc5c
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.util.Scanner; public class D { static Point[] P = new Point[8]; static int[] A = new int[8]; public static int norm(Point x) { return x.x * x.x + x.y * x.y; } public static int dot(Point x, Point y) { return x.x * y.x + x.y * y.y; } pub...
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
a5198f65c958050af74813cba589c049
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 TaskB { BufferedReader br; PrintWriter out; StringTokenizer stok; String nextToken() throws IOException { while (stok == null || !stok.hasMoreTokens()) { String s = br.readLine(); if (s == null) { return "-1"; } stok = new StringTokenizer(s); ...
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
cfb1580fdd8d052caf84579cf10f2367
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 static java.lang.Math.*; import java.util.*; import java.io.*; public class D { class P { int x,y; public P(int xx, int yy) { x=xx; y=yy; } public String toString() { return x + "," + y; } } int[][] perm = {{1,2,3,4,}, {1...
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