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
94aea1dd4a5ce2ad3d7cf57a9b580a1b
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; public class RotationMatching { public static void main(String args[]){ Scanner s=new Scanner(System.in); int n=s.nextInt(); int a[]=new int[n]; int b[]=new int[n]; for(int i=0;i<n;i++){ ...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$Β β€” the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ β€” the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
43e4f2f3a524641a1f0792ac91f45bf1
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.*; import java.util.*; public class CF1365C { static class Element implements Comparable<Element>{ int value; int position; Element(int value,int position){ this.value = value; this.position = position; } public int compareTo(Element o...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$Β β€” the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ β€” the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
7952c995136c2c564eb21e07a3e01fd8
train_001.jsonl
1591540500
After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permutation of size $$$n$$$. Let's call them $$$a$$$ and $$$b$$$.Note that a permutation of $$$n$$$ elements is a sequence of numbers...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Scanner; public class Task648C { public static void main(String[] args) { Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int t = 1;//in.nextInt(); // Scanner ...
Java
["5\n1 2 3 4 5\n2 3 4 5 1", "5\n5 4 3 2 1\n1 2 3 4 5", "4\n1 3 2 4\n4 2 3 1"]
1 second
["5", "1", "2"]
NoteFor the first case: $$$b$$$ can be shifted to the right by $$$k = 1$$$. The resulting permutations will be $$$\{1, 2, 3, 4, 5\}$$$ and $$$\{1, 2, 3, 4, 5\}$$$.For the second case: The operation is not required. For all possible rotations of $$$a$$$ and $$$b$$$, the number of matching pairs won't exceed $$$1$$$.For ...
Java 8
standard input
[ "data structures", "constructive algorithms", "implementation", "greedy" ]
eb1bb862dc2b0094383192f6998891c5
The first line of the input contains a single integer $$$n$$$ $$$(1 \le n \le 2 \cdot 10^5)$$$Β β€” the size of the arrays. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_n$$$ $$$(1 \le a_i \le n)$$$ β€” the elements of the first permutation. The third line contains $$$n$$$ integers $$$b_1$$$, $$$...
1,400
Print the maximum number of matching pairs of elements after performing the above operations some (possibly zero) times.
standard output
PASSED
7f3bd21015e4a1388b6752d490b87188
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { public static BufferedReader in; public static PrintWriter out; public static StringTokenizer tok; public static void main(String args[]) throws IOException { //in = new BufferedReader(new InputStreamReader(System.in...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
7d97e3ef8254665226c45d4489c93a95
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.StringTokenizer; public class Reading { static BufferedReader in; static Pr...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
82ef1792c1914b6e25b7b702a701608a
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.*; import java.util.*; public class Reading implements Closeable { private InputReader in; private PrintWriter out; private Reading() throws IOException { in = new InputReader(new FileInputStream(new File("input.txt"))); out = new PrintWriter(new FileOutputStream(new File("o...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
cf7fbe34ca9606d3d499ca613b5220e2
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.util.*; import java.io.*; public class Reading { /************************ SOLUTION STARTS HERE ***********************/ static class Pair implements Comparable<Pair>{ int index,key; Pair(int k,int i){ index = i; key = k; } @Override public int compareTo(Pair o) { return...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
98dff5478edcfc71f85d3cc5c255f505
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.util.*; import java.io.*; public class Reading { public static void main(String[] args) throws Exception { Scanner in = new Scanner(new File("input.txt")); PrintWriter out = new PrintWriter(new File("output.txt")); int n = in.nextInt(); int k = in.nextInt(); Hour[] hours = new Hour[n]; ...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
bc87edef036af23a5fb78257b50cc537
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class CodeForces { public static void main(String[] args) throws Exception { // Scanner input = new Scann...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
8d73d8fbf0fd467774dd63be0925e643
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
//package codeforces; import java.io.BufferedReader; import java.io.Closeable; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.ut...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
f37b6b8369c35a6278ff591a69ff0d62
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.util.*; import java.util.Scanner; import java.io.*; import javax.lang.model.util.ElementScanner6; public class B234 { public static void main(String args[]) throws Exception { Scanner in = new Scanner(new File("input.txt")); PrintWriter pr = new PrintWriter(new File("output.txt"...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
a78ebad7bd198940412ceab5f7e21165
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.util.*; import java.io.*; public class Main234B { public static class set implements Comparable<set> { int a; int b; public set(int a,int b) { this.a=a; this.b=b; } public int compareTo(set that) { if(that.a>this.a) return 1; else if(that.a==this.a) r...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
c6b8edfa5e109e6bcf1209b353032069
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; /** * * @author Hartha */ public c...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
039ca1a2da6de6b00454038281523d62
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.awt.Point; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class B234 { public static void main(String[] args) throws IOException { Scanner in = new Scanner(new File("input.txt")...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
817e633061b9a76d0caf7d7cfe979c26
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class Main{ public static void main(String[] args) throws Exception{ FastScanner sc =new FastScanner(); PrintWriter out=new PrintWriter(new File("output.txt")); int n=sc.nextInt(); int k=sc.nextInt(); List<Pair...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
3f3f56da8c6450c101eb5f9d1fcf67f4
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class Main{ public static void main(String[] args) throws Exception{ Scanner sc = new Scanner((new FileReader("input.txt"))); FileWriter out = new FileWriter("output.txt"); int n=sc.nextInt(); int k=sc.nextInt(); Lis...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
b05e56a2c15d4dc117c9b15957943a8f
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
/** * Platform : Codeforces * Url : http://codeforces.com/problemset/problem/234/B * Verdict : Accepted * */ import java.util.Scanner; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.LinkedHashMap; import java.util.stream.Collectors; import j...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
d1f3d6e0b467f718325615c4084c0a16
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.awt.Point; import java.io.*; import java.util.*; import java.math.*; import static java.lang.Math.*; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Double.parseDouble; import static java.lang.String.*; import javafx.scene.paint.Color; public class...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
a4f516dbb79dc20d7ce81693d2dd87fb
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.util.*; import java.io.*; import java.nio.file.Files; import java.nio.file.Paths; public class Watermelon { static int x; static PrintWriter out; public static void main(String[] args) { Scanner sc=new Scanner(System.in); ArrayList<Integer> list=new ArrayList<>(); // String content = n...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
7aa90d7565ebecda69c38466086941a6
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.StringTokenizer; public class Problem52 { pub...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
57af6a45badf37540e0bda9e51f1aa75
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class Main2 { public static void main(String[] args) throws Exception { Buffere...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
88d431d5a0b4f973f7e97fdb42d1e7af
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
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 javaapplication1; //import java.util.Scanner; import java.io.BufferedReader; import java.io.DataInputStream; import java.i...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
a9fbe808bf078669bd19a0f596289dfa
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.*; import java.util.*; /** * * @author mohanad */ public class x { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); StringBuilder ou = new StringBuilder(); BufferedReader bf = new BufferedReader(new FileReader("input.txt")); S...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
b8c5d719fa45c986b51cf90a47f5236f
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Comparator; import java.util.StringTokenizer; /** * @author artyom */ public class Reading implements Runnable { private BufferedReader in; private PrintWriter out; private StringTokenizer tok; private void solve() throws IOException { ...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
986e7372fa81b0c66b9ecb544cffd4b8
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static class Reader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} public int read() {if (nu...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
c9ea40aa57d4e765ec344ab784702c5d
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; import java.util.StringTokenizer; public class Solution { public static void main(String[] args) throws IOException { //BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); //Buff...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
51c3d40abc94ad5035465c210c597f17
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.util.Arrays; import java.util.Scanner; public class PA { public static void main(String[] args) throws Exception { new PA().run(); } private void run() throws Exception { Scanner sc = ne...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
2c265b20e391aa76a72137b0723728a1
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.math.BigInteger; import java.util.*; import java.io.*; public class test { public static class list{ int index; int item; public list(int item,int index){ this.index=index; this.item=item; } } public static void main(String[] args) throws IOException { File inFile = new F...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
41e5dbe4d2435945a0a58096d11c23ae
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
//package Practice2.CF234; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class CF234B { public static void main(String[] args) throws Exception{ Scanner s = new Scanner(new File("input.tx...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 8
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
5f3c5239ef8bda231a06518900746303
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class B { int n; char[] v; public B(int n, String s) { this.n = n; v = s.toCharAr...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 6
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
57bccc8646b6ee29943fe8ced2fdc0cf
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws IOException { new B().run(); } InputReader in; PrintWriter out; public void run() throws IOException { in = new InputReader( new FileInputStream("input.txt") ); out...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 6
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
8736b2a3eb5439badf7b2f47408bb139
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.util.*; import java.io.*; public class cf145a { static BufferedReader br; cf145a(){ //System.out.println("wew"); init(); } static void init() { try { br = new BufferedReader(new FileReader("input.txt")); } catch (Exception e) { Syste...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 6
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
45d2d7bdc06582eb830cc8436f3133c1
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
//package Round_145; import java.util.*; import java.io.*; public class b { class p implements Comparable<p>{ int a; int id; p(int a, int id){ this.a = a; this.id = id; } @Override public int compareTo(p o) { return o.a - this.a; } } String input = "input.txt"; String output = "output.txt...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 6
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
57650eedb8237d235c6fb4ceb0a145fd
train_001.jsonl
1350370800
Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed k hours for this. He also found that the light in the train changes every hour. The light is measured on a scale from 0 to 100, where 0 is very dark, and 100 is very light...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class P234B { public void run() throws Exception { int n = nextInt(); int k = nextInt(); int [] a = new int [n]; boolean [] u = new boolean [n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } StringBuffer res = new...
Java
["5 3\n20 10 30 40 10", "6 5\n90 20 35 40 60 100"]
1 second
["20\n1 3 4", "35\n1 3 4 5 6"]
NoteIn the first sample Vasya should read at the first hour (light 20), third hour (light 30) and at the fourth hour (light 40). The minimum light Vasya will have to read at is 20.
Java 6
input.txt
[ "sortings" ]
a585045a9a6f62bfe1c0618c2ee02f48
The first input line contains two integers n and k (1 ≀ n ≀ 1000, 1 ≀ k ≀ n) β€” the number of hours on the train and the number of hours to read, correspondingly. The second line contains n space-separated integers ai (0 ≀ ai ≀ 100), ai is the light level at the i-th hour.
1,000
In the first output line print the minimum light level Vasya will read at. In the second line print k distinct space-separated integers b1, b2, ..., bk, β€” the indexes of hours Vasya will read at (1 ≀ bi ≀ n). The hours are indexed starting from 1. If there are multiple optimal solutions, print any of them. Print the nu...
output.txt
PASSED
264b152c159564d87459c32ac45cefd7
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.InputMismatchException; ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
0b84f0bf8f97ebee30900b472f6b7e6a
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Temp...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
20ec74c062e0ab3c842fdd787242ae90
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) { new Main().run(); } FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run() { work(); out.flush(); } long mod = 998244353; long gcd(long a, long b) { return b == 0 ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
db3a2d1234b8b2e5212af53a5f71dd08
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class TaskA { private static class Antenna { int position; int range; public Antenna(int position, int range) { this.position = position; this.range = range; } int rightBorder() { return pos...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
c8216f6a29f1024d1c34317ef249e4a3
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.util.*; import java.io.*; public class Main { static int[]dp; static boolean[] cov; static int[] pos; static int[] s; static int n,m; static int solve(int i){ if(i>m) return 0; if(dp[i]!=-1) return dp[i]; int ans = (int) 1e9; for(int j=0; j<n; j++){ ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
b76f977466c48a9c65ac4d56d75982af
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class E { public static void main(String[] args) throws Exception { // StringTokenizer stok = new StringTokenizer(new Scanner(new File("F...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
cdd6cbf2a6a5bddc8a5fb71c4bf32a63
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.*; import java.util.*; public class Main { static FastReader in; static PrintWriter out; static final int INF = (int) 1e9; static void solve() { int n = in.nextInt(); int m = in.nextInt(); int[] x = new int[n]; int[] s = new int[n]; for (int i =...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
36fcc576da97051e4c4cc643b0904c8f
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import static java.lang.Math.*; import static java.util.Arrays.*; import java.util.*; import java.util.stream.*; public class E { public Object solve () { int N = sc.nextInt(), M = sc.nextInt(); int [][] A = sc.nextInts(N); sort(A, by(0)); int [] C = new int [M+1]; fill(C, INF); for (int i : rep(N)) { ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
941a26f684e3a97a8f8cf176e2fa818a
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import static java.lang.Math.*; import static java.util.Arrays.*; import java.util.*; import java.util.stream.*; public class E { public Object solve () { int N = sc.nextInt(), M = sc.nextInt(); int [][] A = sc.nextInts(N); sort(A, by(0)); int [] C = new int [M+1]; fill(C, INF); for (int i : rep(N)) { ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
c5d4f707ab8828b03495817470ae2296
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import static java.lang.Math.*; import java.util.*; import java.util.stream.*; public class E { public Object solve () { int N = sc.nextInt(), M = sc.nextInt(); int [][] A = sc.nextInts(N); sort(A, by(0)); Map<Integer, Integer> Z = new HashMap<>(); for (int i : rep(N)) { int X = A[i][0], S = A[i][1],...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
e52369aa4feefdb301c06391b3b434e8
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual soluti...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
8749ae44424d504a9f8fb7bec2b1b96a
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.util.*; import java.io.*; import java.io.FileWriter; // Solution public class Main { public static void main (String[] argv) { new Main(); } boolean test = false; final int MOD = 998244353; //1000000007; public Main() { FastReader in = new FastReader(new Bu...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
72124eaf8a37ef3e898825e2dfbed918
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.util.*; import java.io.*; public class E { public static void main(String[] args) { FastScanner scanner = new FastScanner(); PrintWriter out = new PrintWriter(System.out, false); int n = scanner.nextInt(); int m = scanner.nextInt(); int[][] d = new int[n][2]; ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
61e38e16c1977a6dcb759057c9a5960d
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.io.InputStream;...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
39a6d90f7034ebaab191a869b5365ff9
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class thing { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); Point[] x_s = new Point[n]; for(int i = 0;...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
af530058bacaef57a59e40c5e0854462
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeMap; /* 2 50 25 24 40 2 */ public class E{ static int N,M; static Ant ar[]; static int dp[][][]; static int covere...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
8c0b2ea7b650fd245ae44ae17ad2d261
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.BufferedInputStream; import java.io.InputStream; import java.io.PrintStream; import java.util.Arrays; import java.util.Comparator; import java.util.Locale; import java.util.Scanner; public class ETask { private static final String QUICK_ANSWER = "NO"; private final Scanner in; private final...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
1fc5dce2ee33f3353f0350627fd393c3
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStream; ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
8842c85bb0227d98f63dd8ec4ee34cc5
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
/* Rajkin Hossain */ import java.io.*; import java.util.*; import static java.lang.Math.*; public class E { FastInput k = new FastInput(System.in); //FastInput k = new FastInput("/home/rajkin/Desktop/input.txt"); FastOutput z = new FastOutput(); int n, m; Pair [] antenas; int [][...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
f0e9c725f78377b378c36cacc827a2e7
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.*; import java.util.*; public class AntennaCoverage { public static long INF = Long.MAX_VALUE/2; public static void main(String[] args) throws IOException{ BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter((new OutputStream...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
0ac6ce232bf5e96123b97250eb47fed2
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.BufferedInputStream; import java.io.InputStream; import java.io.PrintStream; import java.util.Arrays; import java.util.Comparator; import java.util.Locale; import java.util.Scanner; public class ETask { private static final String QUICK_ANSWER = "NO"; private final Scanner in; private final ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
2e4da7f0902e0cbf7d881aceed9998c9
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.util.*; import java.io.*; public class E { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); n = Integer.parseInt(st.nextToken()); m = Integer.parseInt(st.nextT...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
6e4d53fadc0b5eb80741655ef2bc50d3
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import org.omg.CORBA.MARSHAL; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.util.*; import java.io.*; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
a28cde8de7a82d4a41bb76515bf137df
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcept...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
c87ccfaa73b36db380b578908a45f6e2
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.util.Scanner; import static java.lang.Math.*; public class E { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt() + 1; int p[] = new int[n]; int s[] = new int[n]; int pokr[] = new in...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
00932e8e7692eea90ffcdb5adbd4b34d
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { static int inf = (int) 1e9 + 7; public static void main(String[] args) throws IOException { sc = new Scanner(System.in); pw = new PrintWriter(System.out); int n = sc.nextInt(); int m = sc...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
51b391a296401165b65b64ad08b0f490
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.InputStream; /**...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
7e6130268eda22d094789f8777d0c0d6
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
//package codeforces.round600div2; import java.io.*; import java.util.StringTokenizer; public class AntennaCoverage { public static void main(String[] args) { // try { // FastScanner in = new FastScanner(new FileInputStream("src/input.in")); // PrintWriter out = new PrintWriter(new Fi...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
b3f2c5e4d691c2bcd221a292de8245e9
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.*; import java.util.*; public class tr7 { public static void main(String[] args) throws Throwable { Scanner sc = new Scanner(); PrintWriter pw = new PrintWriter(System.out); n = sc.nextInt(); m = sc.nextInt(); x = new int[n]; s = new int[n]; ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
60cef1e1849e1ee32df444caaeba9a22
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.awt.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.List; public class Main { public static void main(String[] args) throws IOException { FastReader sc = new FastReader(); int n=sc.nextInt(),m=sc.nextI...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
7359158a89c5b09d4aeb42a4a2e0de5d
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.*; import java.util.*; /** * A simple template for competitive programming problems. */ public class Banana { final InputReader in = new InputReader(System.in); final PrintWriter out = new PrintWriter(System.out); boolean DEBUG = false; int n; int m; int[] dp; int[] x; int[] s; vo...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
68b4ccf21cbfcb653da220ce7805fb5e
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.*; import java.util.*; /** * A simple template for competitive programming problems. */ public class Banana { final InputReader in = new InputReader(System.in); final PrintWriter out = new PrintWriter(System.out); boolean DEBUG = false; void solve() { int n = in.nextInt(); ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
97bf81f33c57ffac0f0609ad597d76e6
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
/*Author: Satyajeet Singh, Delhi Technological University*/ import java.io.*; import java.util.*; import java.text.*; import java.lang.*; import java.math.*; public class Main{ /*********************************************Constants******************************************/ static PrintWriter ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
256bb8f6958d47081cde40a5ba3cc962
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
/** * BaZ :D */ import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static MyScanner scan; static PrintWriter pw; static long MOD = 1_000_000_007; static long INF = 1_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main(Strin...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
02e4fd671ed2b23778352f4d5244b0bb
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.util.Comparator; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution i...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
0be4faa2edf9cd8299c79464a9786d47
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.util.Comparator; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution i...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
ce07f40d078823779bd11c6b7daaac8e
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
/* If you want to aim high, aim high Don't let that studying and grades consume you Just live life young ****************************** If I'm the sun, you're the moon Because when I go up, you go down ******************************* I'm working for the day I will surpass you https://www.a2oj.com/Ladder16.html */ impor...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
9b8a4fb0ecc597e2bebe529eb75f9ea0
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class C { public static void main(String[] args) { FastReader scan = new FastReader(); PrintWriter out = new Pr...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
6f5caeb1ba538421f0f498594f331e81
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author KharYusuf */ public class ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
dd1e2a7b549a86deaa93aa77010b56bd
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; 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.StringTokenizer; import java.util.TreeSet; public class Main { static A...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
96df3e8f746a1faeae9afced36586dcf
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.*; import java.util.*; public class ProblemE { public static InputStream inputStream = System.in; public static OutputStream outputStream = System.out; public static void main(String[] args) { MyScanner scanner = new MyScanner(inputStream); PrintWriter out = new PrintWrite...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
583ad01c7047351b5cefb9de4ff1a6b4
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class antena { private static List<lamp> lamps = new ArrayList<>(); public static void ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
3f921a95ff3ac7c69175aa508204ea56
train_001.jsonl
1573914900
The mayor of the Central Town wants to modernize Central Street, represented in this problem by the $$$(Ox)$$$ axis.On this street, there are $$$n$$$ antennas, numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th antenna lies on the position $$$x_i$$$ and has an initial scope of $$$s_i$$$: it covers all integer positions i...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } long mod=998244353; long gcd(long a,long b) { return b==0?a:gcd(b,a%b); ...
Java
["3 595\n43 2\n300 4\n554 10", "1 1\n1 1", "2 50\n20 0\n3 1", "5 240\n13 0\n50 25\n60 5\n155 70\n165 70"]
3 seconds
["281", "0", "30", "26"]
NoteIn the first example, here is a possible strategy: Increase the scope of the first antenna by $$$40$$$, so that it becomes $$$2 + 40 = 42$$$. This antenna will cover interval $$$[43 - 42; 43 + 42]$$$ which is $$$[1; 85]$$$ Increase the scope of the second antenna by $$$210$$$, so that it becomes $$$4 + 210 = 214$...
Java 8
standard input
[ "dp", "sortings", "greedy", "data structures" ]
fccb8049e7b0f0bcd1dcd93620a86b5c
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 80$$$ and $$$n \le m \le 100\ 000$$$). The $$$i$$$-th of the next $$$n$$$ lines contains two integers $$$x_i$$$ and $$$s_i$$$ ($$$1 \le x_i \le m$$$ and $$$0 \le s_i \le m$$$). On each position, there is at most one antenna (values $$$x_i$$$ are p...
2,200
You have to output a single integer: the minimum amount of coins required to make all integer positions from $$$1$$$ to $$$m$$$ inclusive covered by at least one antenna.
standard output
PASSED
91bd6fb0ba00925fb909768afce6dc20
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
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 code.force; import java.util.*; /** * * @author Abdo Harby */ public class Cupboards { public static void main(String[...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
888653c1522fd636ae5d6a50262ad175
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.io.*; import java.util.*; public class CF { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(System.in); int n = in.nextInt(); int l = 0; int r = 0; for (int i = 0; i < n; i++) { l += in.nextInt(); ...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
6bb684dff8f97e4366e60e9c2d345aa1
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.Scanner; public class Cupboards { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n, i, sum_r = 0, sum_l = 0, t = 0; n = in.nextInt(); int l[] = new int[n]; int r[] = new int[n]; for(i = 0; i < n; i++) { l[i] = in.nextInt(); sum_l += l[i]; ...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
0b69b6fedfd85aa031a4508406f4d474
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.Scanner; public class que17 { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int l = 0, r = 0; for (int i = 0; i < n; i++) { int li = scn.nextInt(); int ri = scn.nextInt(); if (li == 0) { l++; } if (ri == 0) { r++;...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
487e4020ab108b08970a16ef10ed2e2f
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.Scanner; public class codeforces { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int al = 0; int ar = 0; int t = 0; for (int i = 0; i < n; i++) { al += sc.nextInt(); ar += sc.nextInt(); } if(al<n-al){ t+=al; }else{...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
1f760bb45392fbffce1a9d3a8a88af08
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.Scanner; public class cupboards{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.nextLine()); int lZ =0, lO = 0, rZ = 0, rO = 0; for(int i =0; i< n; i++) { int in1 = sc.nextInt(); int in2 = sc.nextInt(); if(in1 == 0) ...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
565f6982c60624b82e1147ee92268e6f
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.*; import java.lang.*; import java.util.Scanner; import java.io.*; public class prac11 { public static void main (String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int n01=0; int n02=0; ...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
ed72a9214f1abf2942f7bddef56ac0ed
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.Scanner; public class Cupboards { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ls = 0; int rs = 0; for(int i=0; i<n; i++){ ls += sc.nextInt(); rs += sc.nextInt(); } int sum = 0; if(ls<=n/2) sum += ls; else ...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
f2a904af2e2a37d3aa070222e7209bc6
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.*; import java.io.*; //267630EY public class Main238A2 { static PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int minl=Integer.MAX_VALUE; int minr...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
55bcc1c5609e4506e3c57185839008d0
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.*; import java.io.*; public class Main248A { static PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int ro=0; int r1=0; int lo=0; int l1=0; for(int i=0;i...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
574996c8035f7d66ab8c22e5cd7fe815
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.Scanner; public class Cupboards{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int testCases = sc.nextInt(); int countLeft1 = 0; int countRight1 = 0; int countLeft0 = 0; int countRight0 = 0; int result = 0; while(testCases-- > 0){ int left = sc....
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
f488fd3993ed6c690af7bb1c4905bc7d
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.*; public class insight { public static void main(String... ar) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] left = new int[n]; int[] right = new int[n]; int leftZero = 0; int rightZero = 0; for (int i = 0; i < n; i++) ...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
a82d0779ab1419bc44dd69c73e86b78f
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.Scanner; public class Main2 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] left = new int[n]; int[] right = new int[n]; int onesLeft = 0; int zeroesLeft = 0; int onesRight = 0; int zeroesRight = 0; for(int i=0;i<n...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
1aae9837b113d798fb899492860d9330
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=new Scanner (System.in); int z=in.nextInt(); int x,y,sum=0,sum2=0; for (int i=0;i<z;i++) { x=in.nextInt(); ...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
d2cc5e9715868b88e6f73deabdeb6bab
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.*; import java.lang.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] l = new int[n]; int[] r = new int[n]; for(int i=0;i<n;i++){ l[i] = sc.nextInt();...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
2007a648420b803ac64cea79088b6583
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.*; public class Cupboards{ public static void main(String[]args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int [] Left = new int [N]; int [] Right = new int [N]; int L0 = 0; int L1 = 0; int R1 = 0; int R0 = 0; int timeR = 0; int timeL = 0; for(int i =0; i < N;i++){ int l = sc.nextInt(...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
6f8932ddbf87a0b2f8720d7a3e1b2760
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.Scanner; /** * * @author pc */ public class Main { /** * @param args the command line arguments *...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
a6c0c46332f1303774b5a0bc776429a2
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main{ public static void main(String[] args) throws IOException { BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(bf.readLine()); int R_Z=0; int R_O...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
f495972d38455a710f7dbea9c34cc40b
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.Scanner; public class Cupboards { public static void main (String [] args) { Scanner sc = new Scanner (System.in); int number = sc.nextInt(); int l1=0,l0=0,r1=0,r0=0; int result =0 ; for( int i = 0 ; i < number; i++) { int l = sc.nextInt(); if(l == 0 ) { l0++; }else { l1++...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
8ab28367521e62ca1248147ca33cd549
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner scan=new Scanner(System.in); int n=scan.nextInt(); int l[]=new int[n]; int r[]=new int[n]; for(int i=0;i<n;++i){ l[i]=scan.nextInt(); r[i]=scan.nextInt(); } int left=0; int right=0;...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
1dc7f2c4a4f8de65851276544d0a99dc
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(), left = 0, right = 0; for(int i = 0; i<n; i++) { if(input.nextInt() == 1) left ++; if(input.nextInt() == 1...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
41a84fb5d9e57b11928dc6a3bdc5b015
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.Scanner; public class practice { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int lc = 0, rc = 0; for (int i = 0; i < n; i++) { int a = input.nextInt(); int b = input.nextInt(); lc += a; rc += b; } Syste...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output
PASSED
d8d58989889a6ab025a40297661c1fb4
train_001.jsonl
1353857400
One foggy Stockholm morning, Karlsson decided to snack on some jam in his friend Lillebror Svantenson's house. Fortunately for Karlsson, there wasn't anybody in his friend's house. Karlsson was not going to be hungry any longer, so he decided to get some food in the house.Karlsson's gaze immediately fell on n wooden cu...
256 megabytes
import java.util.Scanner; public class practice { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int lc = 0, lo = 0, rc = 0, ro = 0; for (int i = 0; i < n; i++) { int a = input.nextInt(); int b = input.nextInt(); if (a == 0) lc++; ...
Java
["5\n0 1\n1 0\n0 1\n1 1\n0 1"]
2 seconds
["3"]
null
Java 8
standard input
[ "implementation" ]
2052b0b4abdcf7d613b56842b1267f60
The first input line contains a single integer n β€” the number of cupboards in the kitchen (2 ≀ n ≀ 104). Then follow n lines, each containing two integers li and ri (0 ≀ li, ri ≀ 1). Number li equals one, if the left door of the i-th cupboard is opened, otherwise number li equals zero. Similarly, number ri equals one, ...
800
In the only output line print a single integer t β€” the minimum number of seconds Karlsson needs to change the doors of all cupboards to the position he needs.
standard output