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
cb9821750b0471e5fbd6693a81c54e30
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class main{ public static void main(String[] args){ Scanner leer1 = new Scanner(System.in); int n = leer1.nextInt(); String number = leer1.next(); if(n%2==0){ for(int i=0;i<n;i++){ System.out.print(number.charAt(i)); if(i%2!=0 && i!=n-1){ System.out.print('-'); ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
6209f0b36a92305d72da2b7ce2a32935
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.StringTokenizer; public class MartesD { static class Scanner { BufferedReader br = new BufferedReader(new InputS...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
ee0bb6eb5d001effdbb1cd100c991339
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); in.nextLine(); String phone = in.nextLine(); StringBuffer bu...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
87ad433e77fa3b92d3b4ab255d41b4ff
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Main { public static void main (String[] args) throws IOException { InputStreamReader isr=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(isr); int n=Integer.parseInt(in.readLine());...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
5dfd18e4b4755e8d23d49abfead296ab
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import java.util.Stack; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(), k = 0; scanner.nextLine(); char [] values = scanne...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
992bd4e88097619d66c10f3a40f114ee
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class PhoneNumber { public static void main(String[] args) { Scanner input=new Scanner(System.in); int i=0, a=0; int number=input.nextInt(); String phnumber=input.next(); if(number%2==0) { System.out.print( phnumber.substri...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
eb465b27ec14fde18cda67f1837f2762
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class PhoneNumbers { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
ebe2e0fdb4586581d68bdc8e74effd14
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Test3 { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in.readLine(); String phoneNumber = in.readLine(); Syste...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
9bdec0441ac0c47112e7d02d19a035b1
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class Main { public static void main (String args []){ Scanner input = new Scanner (System.in); int n ; String s ; boolean flag = false ; int counter = 0 ; String s1 =""; n = input.nextInt(); s = input.next(); if(n % 2 != 0){ int n1 = n-3 ; while ( n1 / 2 != 0...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
4004c2ff4e06863e5531b255cf117994
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; //problem3 public class Main { public static void main (String args []){ Scanner input = new Scanner (System.in); int n ; String s ; boolean flag = false ; int counter = 0 ; String s1 =""; n = input.nextInt(); s = input.next(); if(n % 2 != 0){ int n1 = n-3 ; while ( n...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
b03f3eb94c64cf35735b4a0ee34dc400
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) throws Exception{ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); String s = scan.next(); int a = s.length() % 2 < 1 ? 2 : 3; for(int i = 0; i < s.length() - a; i+=2){ ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
666b49591a3e909be9859a0d267b161f
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class B25 { public static void main (String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(); char[] t =in.next().toCharArray(); StringBuffer sb = new StringBuffer(""); if(n%2==0){ for(int i = 0 ; i < n ;i+=2){ sb.append(t[i]+""); sb.append(t[i+...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
ee185fa58c0d6f218fd761f9902c3572
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class Phone_numbers { public static void main(String args[]){ Scanner in = new Scanner(System.in); int n = in.nextInt(); String a = in.next(); if(n%2==0){ for(int i=0;i<n-1;i+=2){ System.out.print(a...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
baf759360d2c43db7bdbbc79a15d99c2
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.*; import java.util.*; public class PhoneNumbers2 { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(f.readLine()); String str = f.readLine(); for (int i = 0; ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
acb22ecd813a04794e51ae647894a3fe
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.*; public class Solution { static void parse(String num, int n) { int begin = 0; while (begin < n) { System.out.print(num.substring(begin, begin + 2)); begin += 2; if (begin != n) System.out.print("-"); } } publi...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
6c0e56f665f599992b5e323e752dfce8
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class phones { public static void main(String[] args) { Scanner inp = new Scanner(System.in); int len = inp.nextInt(); String num = inp.nextLine(); num = inp.nextLine(); if(num.length() % 2 ==0){ for(int i = 0 ; i < num.length() ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
a3069cbe9aa8e7bfa638e93df50ad5a3
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner input = new Scanner(System.in); int n = input.nextInt(); String[] m = input.next().split("(?!^)"); for(int i = 0; i < n;i++){ System.out.print(m[i]); if(i%2 == 1 && i < (n - (n%2) - 2)){ System.out.pri...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
f8769ac6a9de717d8d805d4ddb4a722f
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class Phone_Numbers { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); int x=input.nextInt(); String number=input.next(); String s=""; while(number.length()>3){ s=s+n...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
ea4f7cdc982840305de2f7467be7430c
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
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); int n = in.nextInt(); String num = in.next(); if(n % 2 == 0){ ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
55c7fe73897f7f58711ff4807f05a886
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class PhoneNumber { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { int n = scanner.nextInt(); String phoneNumber = scanner.next(); String dividedPhoneNumber = ""; if (n % 2 == 0) { for (int i = 0; i <...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
d20aad7e3dba4380c87f335cd912d9e6
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; impor...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
1c00ac32784fbf4facd4d9863ffd13bd
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; /** ** Created by Alik on 10/25/2015. */ public class Problem_25B { public static void main(String[] args){ Scanner in = new Scanner(System.in); int length = in.nextInt(); String dummy = in.nextLine(); String input = in.nextLine(); String result...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
63ee73e589dfa2e63c3f59655ec55afa
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.Scanner; public class Main25B { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); String s = scanner.next(); String r = ""; if (n%2!=0) n--; for (int i = 0;i<n;i++){ r+=s.charAt(i); if (i!=0&&i!=n-1&&i%2!=0) r+='...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
c374eec71625a1b0fe4e5705dadfeb24
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.*; public class PhoneNumbers2{ public static void main(String[] Args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); for(int k = 0;k+3<n;k+=2){ System.out.print(s.substring(k,k+2)+"-"); } System.out.println(s.substring(n...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
c263cb01367f1bb8a7ff28992e10f0bc
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.StreamTokenizer; import java.util.Scanner; public class Codeforces { private void run() throws IOException { Scanner sc = new Scanner(System.in...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
eeb9b0d2f4ca0d2845067c623246e241
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class Main4 { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // Scanner in = new Scanner...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
77b87c070fee5a91b4b2529a238f13f6
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.util.*; public class Practica_1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String ln = in.next(); int dos = 0; String cdn = ""; if ((n & 1) > 0) { int pos = -1; while (tr...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
622380bda63700bf4cf82806a836f3af
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; impor...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
22b1cbd180ef00477a0cc3b255d3fadd
train_001.jsonl
1280761200
Phone number in Berland is a sequence of n digits. Often, to make it easier to memorize the number, it is divided into groups of two or three digits. For example, the phone number 1198733 is easier to remember as 11-987-33. Your task is to find for a given phone number any of its divisions into groups of two or three d...
256 megabytes
import java.io.*; import java.util.*; public class p25b { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println(); int n = sc.nextInt(); String str = sc.next(); String s = ""; String s1 = "-"; if(n%2==0) ...
Java
["6\n549871", "7\n1198733"]
2 seconds
["54-98-71", "11-987-33"]
null
Java 7
standard input
[ "implementation" ]
6f6859aabc1c9cbb9ee0d910064d87c2
The first line contains integer n (2 ≤ n ≤ 100) — amount of digits in the phone number. The second line contains n digits — the phone number to divide into groups.
1,100
Output any of divisions of the given phone number into groups of two or three digits. Separate groups by single character -. If the answer is not unique, output any.
standard output
PASSED
4dbfe69b3cb56898e5fa6dea8570fc77
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.StringTokenizer; public class Solution { static InputReader in = new InputReader(System.in);...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
af665b80c3efb98a7b1687bdcf734dd5
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class TestA { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int x = in.nextInt(); ArrayList<Integer> arrT = new ArrayList<Integer>(...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
84ae7291a1d71e62d9990f2814afb494
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
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.Stack; import java.util.StringTokenizer; public class Candy implements Comparable { int height; int type; int mass; public Candy(int t, int h, int ...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
4c8818707e3912108921a6da1b092468
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class A { BufferedReader reader; StringTokenizer tokenizer; PrintWriter out; public void solve() throws IOException { int N = nextInt(); int...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
ee286f5da0edfa83917b3f18e69022d3
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.util.Collections; import java.util.HashMap; import java.util.Scanner; //import java.util.Set; public class A436 { static int type[] = new int[2000]; static int height[] = new int[2000]; static int mass[] = new int[2000]; static int lines; public static void main(String[] args) { Scanner sc = new ...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
b8dd5e21c22ade0861ba1632c43ed753
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.util.*; public class ProblemA { static int n; static int start_height; static int t[]; static int h[]; static int m[]; static int table[][]; public static void readInput() { Scanner sc = new Scanner(System.in); n = sc.nextInt(); start_height = sc.nextInt(); t = new int[n]; h = new...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
d1a99568492489332b96963996161dd0
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.util.Comparator; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Reader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the ...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
e11419682e6c5372ac48fa6fe41e7fb8
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.io.*; import java.util.*; public class FeedWithCandy4 { static public class FastScanner { java.io.BufferedReader br; StringTokenizer st; public FastScanner() { init(); } public FastScanner(String name) { init(name); } public FastScanner(boolean isOnlineJudge) { if (!isOnlineJudge...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
df499832ad7b7cc61ea04c0f6f89cec6
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.util.*; import java.io.*; public class Main implements Runnable { public void solve() throws IOException { int N = nextInt(); int W = nextInt(); int[] t = new int[N]; int[] h = new int[N]; int[] w = new int[N]; ...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
b82a515807b0975401624cd025d0b02c
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Asecond implements Runnable { void solve() { int n = nextInt(), x = nextInt(); int[] t = new int[n], h = new int[n], m = new int[n]; for (int i = 0; i < n; i++) { t[i] = nextInt(); h[i] = nextInt(); m[i] = nextInt(); } int an...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
4949f1d16ff97bc82e49bcdb0609674f
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.util.*; import java.io.*; public class A { FastScanner in; PrintWriter out; int n; int[] t, h, m; int sol(int type, int x) { boolean[] was = new boolean[n]; int res = 0; for (int i = 0; i < n;) { int maxi = -1; for (int j = 0; j < n; j++) if (!was[j] && t[j] == type && h[j] <= x) { ...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
ac7bd782c772d4aea27a83ed441c713c
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.io.*; import java.util.*; public class Main implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer st; String nextToken() throws IOException { while (st == null || !st.hasMoreTokens()) { st = new StringTokenizer(in.readLine()); } retur...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
33ad6aee580c20b38883a9d00a178fe6
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.util.Scanner; /** * * @author Mbt */ public class A { public static void main(String[] args) { new Solver().solve(); } } class Solver{ final int MAXN= 2001; Candy[] candies= new Candy[MAXN]; int n, x; void solve(){ Scanner reader= new Scanner(System.in); ...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
14c8b346eaf3afc250722ec841f12281
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class OmNom { /** * @param args */ static int h; public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int heightt=sc.nextInt(); h=heightt; ArrayList<candy>f=new ArrayLi...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
95de09cdd4b3e2c9aa20b4e181f05d30
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.util.*; public class A { public static void main(String[] args) { Scanner reader = new Scanner(System.in); int n = reader.nextInt(); int x = reader.nextInt(); ArrayList<Integer> height1 = new ArrayList<Integer>(); ArrayList<Integer> mass1 = new ArrayList<Integer>...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
0e9000e6a090869994ef3a58917a9505
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.awt.List; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Scanner; public class pa62 { public static void main(String args[]){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int x=sc.nextInt(); int count=0; ArrayList...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
327c28b7c23b7ab4f195ad8989e5afa9
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.io.IOException; import java.util.Arrays; import java.io.FilterInputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Zyflair Griffane */ public clas...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
fd2f75b7b2c51a9034345b902ca57350
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class ZeptoA { static class Sweet implements Comparable<Sweet>{ int height; int mass; public Sweet(int height, int mass){ this.height = height; this.mass = mass; } p...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
3cbff4bd82f798597f06f0f64189d78e
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.awt.GradientPaint; import java.awt.geom.Line2D; import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arra...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
6cb4cf32b74cda4b8919b602723fdbf3
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.util.List; import java.util.Scanner; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Collections; import java.util.Comparator; import java.io.IOException; import java.util.ArrayList; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top *...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
f3936b6bd851efbbf9ea56b7b0518fa5
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; public class Zepto { public static void main(String[] args) { Zepto z = new Zepto(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Arr...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
36b9db7d63d2c832fccdde05d90c56e8
train_001.jsonl
1402673400
The hero of the Cut the Rope game is a little monster named Om Nom. He loves candies. And what a coincidence! He also is the hero of today's problem. One day, Om Nom visited his friend Evan. Evan has n candies of two types (fruit drops and caramel drops), the i-th candy hangs at the height of hi centimeters above the ...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.util.Comparator; import java.io.OutputStream; import java.io.PrintWriter; import java.util.NoSuchElementException; import java.io.Writer; import java.math.BigInteger; import...
Java
["5 3\n0 2 4\n1 3 1\n0 8 3\n0 20 10\n1 5 5"]
2 seconds
["4"]
NoteOne of the possible ways to eat 4 candies is to eat them in the order: 1, 5, 3, 2. Let's assume the following scenario: Initially, the height of Om Nom's jump equals 3. He can reach candies 1 and 2. Let's assume that he eats candy 1. As the mass of this candy equals 4, the height of his jump will rise to 3 + 4 = 7...
Java 7
standard input
[ "greedy" ]
6253f6217c58a66573b1ddc6962c372c
The first line contains two integers, n and x (1 ≤ n, x ≤ 2000) — the number of sweets Evan has and the initial height of Om Nom's jump. Each of the following n lines contains three integers ti, hi, mi (0 ≤ ti ≤ 1; 1 ≤ hi, mi ≤ 2000) — the type, height and the mass of the i-th candy. If number ti equals 0, then the cu...
1,500
Print a single integer — the maximum number of candies Om Nom can eat.
standard output
PASSED
9b76fae2798d8fae5a92727fe5685766
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.*; import java.util.*; import java.util.Queue; import java.awt.*; import java.math.*; public class Main { static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer ...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
dff11ca269c44c4fb01795ab8246aec7
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Scanner; import java.util.TreeSet; public class B { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); TreeSet<Long>x=new TreeSet<Long>(); TreeSet<Long>y=new TreeSet<Long>(); for (int i =1; i <=n; i++) { x.add(sc.nextLong()); y.add(sc.nextLong())...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
b61ece4753ded94824c793f7d595e0d7
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Scanner; public class Life { public static void main(String[] args){ Scanner in = new Scanner(System.in); int h=in.nextInt(); int[] x=new int[h]; int []y=new int[h];int c=0,g=0; for(int i=0;i<h;i++){ y[i]+=in.nextInt(); x[i]+=in.nextInt(); } for(int n=...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
27c7b7b6af18ebbbb2a21f73ac60aa17
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sin = new Scanner(System.in); long xmax = -999999999999999999l, xmin = 999999999999999999l, ymax = -999999999999999999l, ymin = 999999999999999999l, x, y, result, n = sin.nextInt(); if(n == 1) ...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
cce3ac583a45093d75d3a7bbbbcbb1a4
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.*;import java.lang.Math;public class Valuable{public static void findArea(long n,Scanner in){long bigX,smallX,bigY,smallY;bigX=smallX=in.nextLong();bigY=smallY=in.nextLong();for(int i=0;i<n-1;i++){long nextX=in.nextLong();long nextY=in.nextLong();if(nextX>bigX){bigX=nextX;}else if(nextX<smallX){smallX=...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
98cd7678fac51a1a47babd3db29cb49d
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.*; import java.lang.Math; public class Valuable{ public static void findArea(long n, Scanner in){ long bigX, smallX, bigY, smallY; bigX = smallX = in.nextLong(); bigY = smallY = in.nextLong(); for(int i=0; i<n-1; i++){ long nextX = in.nextLong(); long nextY = in.nextLong(); if(nextX...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
ee210b58b35bac11a4b1be038180436b
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.*; import java.lang.Math; public class Valuable{ public static void findArea(long n, Scanner in){ long bigX = in.nextLong(); long smallX = bigX; long bigY = in.nextLong(); long smallY = bigY; for(int i=0; i<n-1; i++){ long nextX = in.nextLong(); long nextY = in.nextLong(); //Syste...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
e43cddfa142d73ebc3b7b76b8ab910e7
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.*; import java.lang.Math; public class Valuable{ public static void findArea(long n, Scanner in){ long bigX = in.nextLong(); long smallX = bigX; long bigY = in.nextLong(); long smallY = bigY; for(int i=0; i<n-1; i++){ long nextX = in.nextLong(); long nextY = in.nextLong(); if(next...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
06f3ddeb0d10a7515964298282c6e971
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public final class ValuesResourcesCF { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(br.readLine(...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
adb770fb5ad54d54b6a66a22d01a5602
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
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.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; import java.util.TreeMap; public class zizo { publ...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
1f3a3425545b8bb8769d307688e71186
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.Reader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class B { public B() { Scanner s = new Scanner(); long n = s.nextLo...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
2aaef2985f223b8f3b62966119f006c9
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.*; public class B { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int xmin = Integer.MAX_VALUE, ymin = Integer.MAX_VALUE, xmax = Integer.MIN_VALUE, ymax = Integer.MIN_VALUE; for (int i=1;i<=n;...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
b0ff06a813059fd19d0ac2a097fddd86
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.Collections; import java.util.HashS...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
60974e2bd140f78953f5229c423c805c
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.awt.Point; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java....
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
f2345d8a0a4ed3ffc2f5cd9bc4aa4460
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.*; public class name{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); TreeSet<Long> x = new TreeSet<Long>(); TreeSet<Long> y = new TreeSet<Long>(); for (int i=1; i<=n; i++) { x.add(scan.nextLong()...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
04e0a8a7ee71f1e4eb3b8b8cc05a4518
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { MyScanner sc = new MyScanner(); int n = sc.nextInt(); long[] x = new...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
dc769c86d57097073abb397213ed2820
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long l = 0, r = 0, t = 0, b = 0; for(int i = 0; i < n; ++i) { long x = in.nextLong(); lo...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
a8daea68fa2566d459be36031a8e6d41
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class ValuableResources { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader (new InputStreamReader(System.in...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
9c167fc1eba44408c7d8ae6839ae2f64
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class CF485B { public static void main(String[] args) { FastReader input = new FastReader(); PrintWriter pw =...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
70724c65dee82f3b15cecf01d79ca532
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Valuable_Resources { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); long area = 0; int n = in.nextInt(); int arrX[] = new int[n]; int arrY[] = n...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
9e859d284af17990a9beea7cc0568a82
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.*; public class MyClass { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=1; while(t-->0) { long n=sc.nextInt(); long minx=Long.MAX_VALUE; long maxx=Long.MIN_VALUE; long miny=Long.MAX_V...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
75e5a1486678c43642721623d3d35c92
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
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 Codeforces; /** * * @author Administrator */ import java.util.Scanner; public class c485B { public static void main...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
f95c98aefd00a12fcf43aa03d59938f7
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.StringTokenizer; public class SRM { static class Point { long x, y; Point(long x, long y){ this.x = x; t...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
bef28e5c2e9b05e6288421fbefd6b782
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public stati...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
5084f1942cb8ab788c0cc2e2dc4cced8
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner input = new Scanner(System.in); // while(true){ int number = input.nextInt(); location[] array = new location[number]; for(int i= 0 ; i < number ; i++){ array[i] = new location(input.nextInt(), input.nextInt...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
7a97559328fe3e7efc265ab0f0fbb639
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Scanner; /** * Created by vignesh on 5/5/2017. */ public class valuable_Resources { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long x1 = in.nextLong(); long y1 = in.nextLong(); long xmax = x1; ...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
355fda7d3fa0137b3a97c5224b062c96
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.*; import java.util.StringTokenizer; import static java.util.Arrays.*; public class Main { void solve() throws IOException { int n = nextInt(); int[] x = new int[n]; int[] y = new int[n]; long minX = Integer.MAX_VALUE, minY = Integer.MAX_VALUE, maxX = I...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
61e84619242cdc38fa0d91c8ad1bd679
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.text.DecimalFormat; import java.util.ArrayL...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
983bee8f941312ca01667d63b13e4b7e
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.StringTokenizer; import java.io.InputStream; /** * Built usin...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
1c56ec8d485e90909e4871b944cdfb78
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class TestClass //implements Runnable { int x,y; public TestClass(int x,int y) { this.x=x; this.y=y; } public static void main(String args[]) throws Exception {/* ...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
da1e4648c9276a4da65368ba73fa59bb
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Scanner; public class _2 { public static void main(String[] args) { int n; Scanner input =new Scanner(System.in); n=input.nextInt(); int x1=-1000000000,x2=1000000000,y1=-1000000000,y2=1000000000; int a,b; while(n!=0) { a=input.nextInt(); b=input.nextInt(); x1=Math.max(a,x1); ...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 8
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
7e74b631c537e3af97b64a70092071b6
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { InputStream inputStream = System.i...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 6
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
ede1fa9ed6924185ba2d539402f047f2
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.StringTokenizer; public class T485B { public static void main(String[] args) { FastScanner in = new FastScanne...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 6
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
0f77a40568b72c695e1d9aed58d54249
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long min_x = sc.nextLong(), min_y = sc.nextLong(); long max_x = min_x, max_y = min_y; for(int i = 1; i < n; i++) { long x = sc.nextLong(), y = sc.nextLong...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 6
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
ecb73f9d10ae28ab73ab036285127441
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class MainB { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int n = sc.nextInt(); int x[] = new int[n]; int y[] = new int[n]; ...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 6
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
bbaea76a18659850820f3b9f5c63592b
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Scanner; public class CodeforcesContest485B { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); long minX=Long.MAX_VALUE; long maxX=Long.MIN_VALUE; long minY=Long.MAX_VALUE; long maxY=Long.MIN_VALUE; for(int i=1;i<=n;i++){ long x=sc.next...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 6
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
e82cceed5f34ea1b4717638df9de68d8
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) throws NumberFormatException, IOException { Scanner s = new Scanner(System.in); int n = s.nextInt(); long maxY...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 6
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
e134abc0ad256835b2898c320ded0d7d
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.Scanner; public class CF276B { public static void main(final String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int xmin = Integer.MAX_VALUE, xmax = Integer.MIN_VALUE, ymin = Integer.MAX_VALUE, ymax = Integer.MIN_VALUE; for (int i = 0; i < n...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 6
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
f531740cbd447bd2769d9d56883f308d
train_001.jsonl
1415205000
Many computer strategy games require building cities, recruiting army, conquering tribes, collecting resources. Sometimes it leads to interesting problems. Let's suppose that your task is to build a square city. The world map uses the Cartesian coordinates. The sides of the city should be parallel to coordinate axes. T...
256 megabytes
import java.util.*; public class R276_2_B { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n, x, y, minx, maxx, miny, maxy; n= in.nextInt(); minx = miny = Integer.MAX_VALUE; maxx = maxy = Integer.MIN_VALUE; for (int i = 0; i < n; i++) { ...
Java
["2\n0 0\n2 2", "2\n0 0\n0 3"]
1 second
["4", "9"]
null
Java 6
standard input
[ "greedy", "brute force" ]
016e00b2b960be792d4ec7fcfb7976e2
The first line of the input contains number n — the number of mines on the map (2 ≤ n ≤ 1000). Each of the next n lines contains a pair of integers xi and yi — the coordinates of the corresponding mine ( - 109 ≤ xi, yi ≤ 109). All points are pairwise distinct.
1,300
Print the minimum area of the city that can cover all the mines with valuable resources.
standard output
PASSED
0b9e9f8af9223ea16a858c5e9e6d9048
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
// Working program using Reader Class import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class Div3 { static class Reader { final private int BUFFER_SIZE = 1 << 16...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
9be060ba060dc66f5bfe3d2c1f40f1d0
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
// problem - https://codeforces.com/problemset/problem/1077/B import java.util.Scanner; import java.util.ArrayList; public class Solution { private static final String DISTURBED_STATE = "101"; public static void main(String[] args) { Scanner scanner = new Scanner(System.in); StringBuilder s...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
d6649cc0e277e8993f7502f6261758fe
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class Disturbing { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new Buffere...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
e48067434fb584674f68af78931fa24a
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.Scanner; public class Run { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int tenants[] = new int[n]; for (int i = 0; i < n; i++) { tenants[i] = sc. nextInt(); } int res = 0; ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
c4f962dd73dcc38b6bb5df4e10f5cac2
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.Scanner; public class Disturbed { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int A[] = new int[n]; int disturbes_how_many[] = new int[n]; for (int i = 0; i < n; i++) A[i] = in.nextInt(...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
8d6e07d3985c7c291e46c9e5d081e05a
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.*; public class disturbedPeople { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new Buffered...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
fd41913a84113d34b768373ac2bc797d
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.Scanner; public class Contest { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] lights = new int[n]; for(int i = 0 ; i < n ; i++) lights[i] = s.nextInt(); int ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
bb0a58e7519287e70d18f3a10e5a0d5e
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.Scanner; public class Disturbed { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] arr = new int[n]; for(int i=0;i<n;i++) arr[i] = s.nextInt(); int k = 0; boolean flag = false; ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
4462d878f942e0e2c5f3380436f3e75d
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.Scanner; public class CODEFORCETEST { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); } int count = 0; int i = 1; ...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output
PASSED
d8412390d1078a51f5f8b991c76d41b1
train_001.jsonl
1542378900
There is a house with $$$n$$$ flats situated on the main street of Berlatov. Vova is watching this house every night. The house can be represented as an array of $$$n$$$ integer numbers $$$a_1, a_2, \dots, a_n$$$, where $$$a_i = 1$$$ if in the $$$i$$$-th flat the light is on and $$$a_i = 0$$$ otherwise.Vova thinks that...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.*; public class MyClass { public static void main(String[] args) throws Exception { Scanner sc=new Scanner(System.in); PrintWriter pw=new PrintWriter(System.out); int n=sc.nextInt(); int fwd=0,bwd=0; i...
Java
["10\n1 1 0 1 1 0 1 0 1 0", "5\n1 1 0 0 0", "4\n1 1 1 1"]
1 second
["2", "0", "0"]
NoteIn the first example people from flats $$$2$$$ and $$$7$$$ or $$$4$$$ and $$$7$$$ can turn off the light and nobody will be disturbed. It can be shown that there is no better answer in this example.There are no disturbed people in second and third examples.
Java 8
standard input
[ "greedy" ]
ea62b6f68d25fb17aba8932af8377db0
The first line of the input contains one integer $$$n$$$ ($$$3 \le n \le 100$$$) — the number of flats in the house. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$a_i \in \{0, 1\}$$$), where $$$a_i$$$ is the state of light in the $$$i$$$-th flat.
1,000
Print only one integer — the minimum number $$$k$$$ such that if people from exactly $$$k$$$ pairwise distinct flats will turn off the light then nobody will be disturbed.
standard output