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 | 8488ae2259ef2a6da2925562e38bc2ea | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// CODE HERE
String[] ... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | f8adf763a17553899041790fd09a153f | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.util.Scanner;
import java.util.Arrays;
public class RankList {
static Scanner scn = new Scanner(System.in);
public static void main(String[] args) {
helper();
}
public static void helper() {
int n = (int)input();
int k = (int)input();
int[][] arr = new int[n][2];
for (int i = 0; i < n; i+... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | b270149495f1d246ac821b39ee42668f | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) throws IOException{
FastScanner fs = new FastScanner();
int n = fs.nextInt();
int k = fs.nextInt();
int[] a = new int[n];
HashMap<Integer,ArrayList<Integer>> map = new HashMap<>();
for(int i=0 ; i<n ; i++) {... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | 1174b347ea70300675da634cc61aeed8 | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | // practice with rainboy
import java.io.*;
import java.util.*;
public class CF166A extends PrintWriter {
CF166A() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF166A o = new CF166A(); o.main(); o.flush();
}
void main() {
int n = sc.nextInt();
int k... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | 6cd4844ae2d40fb8ca13ff5406f1a34c | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
/**
* @author AnonymousP
* @__WHEN YOU FEEL LIKE QUITTING, THINK ABOUT WHY YOU STARTED__@
*/
//COMBINATON = nCr = n*(n-1)/2
public class Rank_list {
public static void main(String[] args) {
int t = sc.nextInt();
int c = sc.n... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | f082bcc525b8e7260405827c3b42d6ac | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Rank_List {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new St... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | 78d321437ad1ed483dcc28f77c625aeb | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.util.*;
public class rankLIst
{
public static void main(String[] args)
{
Scanner s1=new Scanner(System.in);
int n=s1.nextInt();
int k=s1.nextInt();
s1.nextLine();
int[] p=new int[n];
int[] t=new int[n];
for(int i=0;i<n;i++)
{
... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | e764957e666e1227230d3d82a77520fc | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.util.*;
public class rankLIst
{
public static void main(String[] args)
{
Scanner s1=new Scanner(System.in);
int n=s1.nextInt();
int k=s1.nextInt();
s1.nextLine();
int[] p=new int[n];
int[] t=new int[n];
for(int i=0;i<n;i++)
{
... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | 12c16a4d982157cc3c4cc5b8e3852f0d | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
Integer [][] arr=new Integer[n][2];
for(int i=0;i<n;i++){
fo... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | 4c68f0b1f3d567d85122b284f1f0ba2c | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.util.*;
public class RankList {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in=new Scanner(System.in);
int n=in.nextInt();
int k=in.nextInt();
k=k-1;
int [][] arr=new int[n][2];
for(int i=0;i<n;i++) {
arr[i][0]=in.nextInt();
arr[i][1]=in.nextInt(... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | 43488df3bfe2730a2fd6ecbe988a95e7 | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.io.*;
import java.util.Arrays;
public class RankList {
static class Team implements Comparable<Team>
{
int problemsSolved;
int penaltyTime;
public Team(int x, int y)
{
this.problemsSolved = x;
this.penaltyTime = y;
}
// descending order
public int compareTo(Team otherTeam)
{
... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | 2f8469e46d0c5a9a853a084004c57db8 | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
static class Team implements Comparable<Team> {
int p;
int t;
Team(int p, i... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | 8c04c9b520baabcb6d4bef39cc710256 | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class A {
public static void main(String[] agrs) {
FastScanner sc = new FastScanner();
// int n = sc.nextInt();
// while(n-->0) {
//
// }
int n = sc.nextInt();
int k = sc.nextInt();
List<Team> list = new ArrayList<>();
Map<String,Inte... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | b4a5ec42bc064e65374a38b1415715d6 | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.Comparator;
import java.util.ArrayList;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author grolegor
*/
publi... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | 5b01da77afcd4f45b3a8c0f7781f2fbe | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.io.*;
import java.util.*;
public class p166A {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
StringTo... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | 394372db5eedd7c5a5ebd0c8e3afbddb | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.util.*;
// warm-up
public class RankList {
static Set<Team> s = new HashSet<Team>();
static class Team implements Comparable<Team>{
int p, t; // Problems solved, penalty time
Team (int a, int b) {
p=a; t=b;
}
public int compareTo (Team other) {
return p==other.p ? t-other.t : other.p-p;
... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | 465032d5b20627e93326a8d191c2bf40 | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution {
static Scanner scr=new Scanner(System.in);
public static void main(String[] args) {
// TODO Auto-generated method stub
// int t=scr.nextInt();
// while(t-->0) {
solve();
System.out.println();
// }
}
static void solve() {
int n=scr.nextInt()... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | eda32c496f7659d9490d62f7a313aa19 | train_001.jsonl | 1332516600 | Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for no team we are shown its final place.You know the rules of comparing the results of two given ... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class ladders166a {
static BufferedReader __in;
static PrintWriter __out;
static StringTokenizer input;
public static void main(String[] args) throws IOException {
__in = new Buffere... | Java | ["7 2\n4 10\n4 10\n4 10\n3 20\n2 1\n2 1\n1 10", "5 4\n3 1\n3 1\n5 3\n3 1\n3 1"] | 2 seconds | ["3", "4"] | NoteThe final results' table for the first sample is: 1-3 places β 4 solved problems, the penalty time equals 10 4 place β 3 solved problems, the penalty time equals 20 5-6 places β 2 solved problems, the penalty time equals 1 7 place β 1 solved problem, the penalty time equals 10 The table shows that the second p... | Java 11 | standard input | [
"sortings",
"binary search",
"implementation"
] | 63e03361531999db408dc0d02de93579 | The first line contains two integers n and k (1ββ€βkββ€βnββ€β50). Then n lines contain the description of the teams: the i-th line contains two integers pi and ti (1ββ€βpi,βtiββ€β50) β the number of solved problems and the total penalty time of the i-th team, correspondingly. All numbers in the lines are separated by spaces... | 1,100 | In the only line print the sought number of teams that got the k-th place in the final results' table. | standard output | |
PASSED | c2e0f11508ca5fe4a6368b1ebf6f7361 | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author dy
*/
public class Main {
public static void main(String[] args) {
InputStream inputStre... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 0f060f48f5e5a06e36a9055e2091e335 | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import java.util.*;
import java.math.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = scan... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 6ee78af8c34bcf5e01d731a08463ac66 | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | // @author Sanzhar
import java.io.*;
import java.util.*;
import java.awt.Point;
public class Template {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine())... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | cf5b86c605da7d52c85852f6c00ae64f | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
scan.nextLine();
String line = scan.nextLine().trim();
String[] tmp = line.split(" ");
int[] p = new int[n];
... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | e5d3414001da9288b61644c68bf6d4b4 | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class D {
static StringTokenizer st;
static BufferedReader br;
static PrintWr... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 6b313204f501efe72677855028d53898 | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import java.util.Scanner;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author ba... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 6ee30c888f2771e18964ca3934df42d4 | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;
public class CF_D {
public static void main(String[] args) throws Exception {
new CF_D();
}
CF_D() throw... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 608794c000c9dd3439d89084e97402ed | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;
p... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 1c174e0d60395a4791693b6c5a683102 | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.StringTokenizer;
public class CodeD
{
static class Scanner
{
BufferedReader br = new BufferedReader(new InputStr... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | ab675f4be51ae3b258a36d4aa6cbfb6b | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args) throws Exception {
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader read = new BufferedReader(input);
... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 1bdc7466e273e607777a241e3d96c1e9 | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | //package com.javarush.test.eoly.spbsu1.force204;
import java.util.Scanner;
/**
* Created with IntelliJ IDEA.
* User: Π²
* Date: 08.10.13
* Time: 9:23
* To change this template use File | Settings | File Templates.
*/
public class D204
{
public static void main(String[] args){
Scanner sc = new Scanne... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 432ee59249096550816dc1cd4570c04f | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import java.io.FileNotFoundException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int ar[] = new int[n];
for(int i = 0; i < n; i++)
ar[i] = sc.nextInt();
int ans = 0;
for... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 3b5fd8e1bde4fc0a63dce9c4cf0c1410 | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args) {
solve(new InputReader(System.in));
}
static void solve(InputReader in) {
int n = in.ni();
... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | c336b8f44bfca551b107faf8b4c8f0bb | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;
import java.io.*;
public class Main {
void solve() {
int n = sc.nextInt();
int[] a = sc.nextIntArray(n);
int f = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i < j && a[i] > a[j]) ++f;
}
}... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 2e36ba14ec876e65263e95cdea716c64 | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import java.util.*;
/**
* @author Assassin
*/
public class D {
private BufferedReader reader;
private PrintWriter out;
private StringTokenizer tokenizer;
//private final String file... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 22c33c125eda6a3fdcc972cc358bbfd8 | train_001.jsonl | 1380900600 | Jeff has become friends with Furik. Now these two are going to play one quite amusing game.At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of n numbers: p1, p2, ..., pn. Then the guys take turns to make moves, Jeff moves first. During his move, Jeff chooses two adjacent... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Solution {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String nextToken() throws IOException {
while (st == null || !st.hasMoreTokens()) {
st = new StringTokenizer(in.readLine());
}
... | Java | ["2\n1 2", "5\n3 5 2 4 1"] | 1 second | ["0.000000", "13.000000"] | NoteIn the first test the sequence is already sorted, so the answer is 0. | Java 7 | standard input | [
"math"
] | c4609bd2b4652cb5c2482b16909ec64a | The first line contains integer n (1ββ€βnββ€β3000). The next line contains n distinct integers p1, p2, ..., pn (1ββ€βpiββ€βn) β the permutation p. The numbers are separated by spaces. | 1,900 | In a single line print a single real value β the answer to the problem. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | c442eb4eb1928c8c863f9b9cb47c92f8 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.util.*;
public class ProblemD {
public static void main(String[] args) {
@SuppressWarnings({ "unused", "resource" })
Scanner sc = new Scanner(System.in);
int N=sc.nextInt();
int M=sc.nextInt();
int K=sc.nextInt();
int[][] stayDAYcost = new int[N][M+1];
sc.nextLine();
for (int i=0;i... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | d2c2a574cfc2e46365c8948e85bb2bfb | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 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 D {
public static void main(String[] args){
FastScanner scan = new FastScanner();
PrintWriter out = new PrintWriter(Syst... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | b468fb46b36744046680eed55d348d9a | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class D946
{
public static int mod = 1000000007;
public static long INF = (1L << 60);
static FastS... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 72acdff5315e43a34f4e5e3deb5ec144 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class D946
{
public static int mod = 1000000007;
public static long INF = (1L << 60);
static FastS... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | e4adfead10211ab5e84bab41814227f8 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes |
import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class D946
{
public static int mod = 1000000007;
public static long INF = (1L << 60);
static FastS... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | be01c73bd1928b81a1b61e27125f2b10 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.Stream;
public class Main implements Runnable {
static final int MOD = (int) 1e9 + 7;
static final int MI = (int) 1e9;
static final long ML = (long) 1e18;
static final Reader in = new Reader();
static final PrintWriter out = new PrintWri... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 92ac4988b4cb2d48b5722f589b67a89a | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.DataInputStream;
import java.io.IOException;
public class Task946D {
public static class FastScanner {
protected static final int STRBUFFERLENGTH = 0x1000;
protected DataInputStream dataInputStream;
protected byte[] buffer = new byte[0x10000];
protected byte[] strb... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | a0376ee1669f1578f8ece7a38154d65f | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.Writer;
im... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 803c9723a5678c93ae4d430663d53e93 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | //package codeforces.Educational39;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class D
{
static int[][] memo;
static int n, m, k;
static char[]... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 5ad7aba266bef53ef31a2c44b28e2f9c | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWri... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 30042d0d62433e9590cdf56964ef02e8 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.PrintWriter;
public class D946
{
static class Scanner
{
BufferedReader br;
StringTokenizer tk=new StringTokenizer("");
... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 7ce10b7cffce3b3136d118910cc975bc | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static InputReader in = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
static int oo = (int)1e9;
// static long oo = (long)1e15;
static int mod = 1_000_000_007;
static int[] dx = {1... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 396b4b34080da7f2e4bdab3f90c3578a | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main extends Thread {
private static FastScanner scanner = new FastScanner(System.in);
private static PrintWriter writer = new PrintWriter(System.out);
// private static Scanner scanner = new Scanner(System.in);
private static ArrayList<Integer>[] ... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | ef00c27565c58d1d5bec6f73e9b60859 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
private static ArrayList<ArrayList<Integer>> classes = new ArrayList<ArrayList<Integer>>();
private static ArrayList<... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 6e7a613a5737751b1fb34bea3e61fdc6 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
public class D {
public static void main(String cd[]) throws Exception{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
Print... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 3b9bf32ee98ef6e73d13493ffcb2bf36 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.util.*;
import java.io.*;
import java.io.FileWriter;
import java.math.BigInteger;
import java.math.BigDecimal;
// Solution
public class Main
{
public static void main (String[] argv)
{
new Main();
}
boolean test = false;
final int[][] dirs8 = {{0,1}, {0,-1}, {-1,0}, {1,0}, {... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 546f052b287169b35983656a24f08d97 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Task... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | cdde81ae2442a38501885f186aa6df5c | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | //package info.stochastic;
import java.io.*;
import java.util.*;
public class D {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(o... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 2de7d28920c9d0bb3d8d8f731d2e13a9 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 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 | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 7d3e02537cc01628df7b6e5989390511 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | // package CF;
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.Arrays;
import java.util.StringTokenizer;
public class D {
static final int INF = (int)1e9;
static int [][]... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 95211e8a920df6e2b54e34530a355d94 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.FileInputStream;
import java.util.Arra... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 693449947af55386c1df18ec47f6e0e5 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 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 Main {
static final int UNCALC = -1, INF = (int) 1e9, max = 501;
static int n, cost[][], memo[][];
public static ... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | e9c0508d8782dda19e41ba0bb709098e | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class D {
public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
// Scanner scan = new Scanner(System.in);
// PrintWriter out = ne... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | dc4dc70bdb7c7cc2d3a4cd0998e7f89e | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
private static ArrayList<ArrayList<Integer>> classes = new ArrayList<ArrayList<Integer>>();
private static ArrayList<... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 8ade94999ef3a11c0c3de03cd5dc1d1f | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.*;
import java.util.*;
public class _946D {
/**********************************************************************************************
* DEBUG *
* - Obvious dp would be try to remember state of the b... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | c7c6eaa711e98edca39f531c5acd8e54 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | //package educational.round39;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class D {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | da5c7befb70c574f112eb99bc427c7fa | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.*;
import java.util.*;
public class _946D {
/**********************************************************************************************
* DEBUG *
* - Obvious dp would be try to remember state of the b... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 37c1f108912f450d7f588ebadf729f0b | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.Arrays;
import java.util.Collection;
import java.io.IOException;
import java.util.OptionalInt;
import java.io.InputStreamReader;
import java.util.ArrayList... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | d1c38576cb369466f95644a81572df1f | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHel... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 9f1a1d55e0c5e6f719cc3c5a8b37684b | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF946D {
static void solve(int[] dp, char[] cc, int n, int k) {
int n1 = 0;
for (int i = 0; i < n; i++)
if (cc[i] == '1')
n1++;
if (n1 == 0)
return;
int[] ii = new int[n1];
n1 = 0;
for (int i = 0; i < n; i++)
if (cc[i] == '1')
ii[n1++] = ... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | bd06ee0d9cf2cba215cb343909ae5e26 | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes | import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Scanner in = new Scanner(inputStream);
Pr... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | d37717d0dc4e98c0a157a604eff5012d | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 256 megabytes |
import java.util.*;
import java.io.*;
public class Timetable_946D {
static void go() {
int n = in.nextInt(), m = in.nextInt(), k = in.nextInt();
List<List<Integer>> dmin = new ArrayList<>();
for(int i = 0; i < n; i++) {
List<Integer> idx = new ArrayList<>();
char[] ... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | 9d9e18d48c012920fb4a5a05910ec13c | train_001.jsonl | 1520348700 | Ivan is a student at Berland State University (BSU). There are n days in Berland week, and each of these days Ivan might have some classes at the university.There are m working hours during each Berland day, and each lesson at the university lasts exactly one hour. If at some day Ivan's first lesson is during i-th hour... | 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.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class... | Java | ["2 5 1\n01001\n10110", "2 5 0\n01001\n10110"] | 2 seconds | ["5", "8"] | NoteIn the first example Ivan can skip any of two lessons during the first day, so he spends 1 hour during the first day and 4 hours during the second day.In the second example Ivan can't skip any lessons, so he spends 4 hours every day. | Java 8 | standard input | [
"dp"
] | cf5650c13ce0404d2df10fa3196d7923 | The first line contains three integers n, m and k (1ββ€βn,βmββ€β500, 0ββ€βkββ€β500) β the number of days in the Berland week, the number of working hours during each day, and the number of lessons Ivan can skip, respectively. Then n lines follow, i-th line containing a binary string of m characters. If j-th character in i-... | 1,800 | Print the minimum number of hours Ivan has to spend in the university during the week if he skips not more than k lessons. | standard output | |
PASSED | f152d7f71110a0c563a41abb42ed124e | train_001.jsonl | 1495958700 | The marmots need to prepare k problems for HC2 over n days. Each problem, once prepared, also has to be printed.The preparation of a problem on day i (at most one per day) costs ai CHF, and the printing of a problem on day i (also at most one per day) costs bi CHF. Of course, a problem cannot be printed before it has b... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt(), k = sc.nextInt();
int [] a = new int[n], b = new int[n];
... | Java | ["8 4\n3 8 7 9 9 4 6 8\n2 5 9 4 3 8 9 1"] | 4 seconds | ["32"] | NoteIn the sample testcase, one optimum solution is to prepare the first problem on day 1 and print it on day 1, prepare the second problem on day 2 and print it on day 4, prepare the third problem on day 3 and print it on day 5, and prepare the fourth problem on day 6 and print it on day 8. | Java 8 | standard input | [
"binary search",
"flows",
"graphs"
] | 08b8dbb6e167db69dc965e8ad4835808 | The first line of input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan () β the preparation costs. The third line contains n space-separated integers b1,β...,βbn () β the printing costs. | 2,400 | Output the minimum cost of preparation and printing k problems β that is, the minimum possible sum ai1β+βai2β+β...β+βaikβ+βbj1β+βbj2β+β...β+βbjk, where 1ββ€βi1β<βi2β<β...β<βikββ€βn, 1ββ€βj1β<βj2β<β...β<βjkββ€βn and i1ββ€βj1, i2ββ€βj2, ..., ikββ€βjk. | standard output | |
PASSED | 08857225a008a2c389ecba2bcdee9855 | train_001.jsonl | 1495958700 | The marmots need to prepare k problems for HC2 over n days. Each problem, once prepared, also has to be printed.The preparation of a problem on day i (at most one per day) costs ai CHF, and the printing of a problem on day i (also at most one per day) costs bi CHF. Of course, a problem cannot be printed before it has b... | 256 megabytes | //package prac;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;
public class Helvetic2017N {
InputStream is;
PrintWriter out;
... | Java | ["8 4\n3 8 7 9 9 4 6 8\n2 5 9 4 3 8 9 1"] | 4 seconds | ["32"] | NoteIn the sample testcase, one optimum solution is to prepare the first problem on day 1 and print it on day 1, prepare the second problem on day 2 and print it on day 4, prepare the third problem on day 3 and print it on day 5, and prepare the fourth problem on day 6 and print it on day 8. | Java 8 | standard input | [
"binary search",
"flows",
"graphs"
] | 08b8dbb6e167db69dc965e8ad4835808 | The first line of input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan () β the preparation costs. The third line contains n space-separated integers b1,β...,βbn () β the printing costs. | 2,400 | Output the minimum cost of preparation and printing k problems β that is, the minimum possible sum ai1β+βai2β+β...β+βaikβ+βbj1β+βbj2β+β...β+βbjk, where 1ββ€βi1β<βi2β<β...β<βikββ€βn, 1ββ€βj1β<βj2β<β...β<βjkββ€βn and i1ββ€βj1, i2ββ€βj2, ..., ikββ€βjk. | standard output | |
PASSED | 70890cd41cc7862cb6bbfc9686b74c83 | train_001.jsonl | 1495958700 | The marmots need to prepare k problems for HC2 over n days. Each problem, once prepared, also has to be printed.The preparation of a problem on day i (at most one per day) costs ai CHF, and the printing of a problem on day i (also at most one per day) costs bi CHF. Of course, a problem cannot be printed before it has b... | 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.util.Iterator;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
imp... | Java | ["8 4\n3 8 7 9 9 4 6 8\n2 5 9 4 3 8 9 1"] | 4 seconds | ["32"] | NoteIn the sample testcase, one optimum solution is to prepare the first problem on day 1 and print it on day 1, prepare the second problem on day 2 and print it on day 4, prepare the third problem on day 3 and print it on day 5, and prepare the fourth problem on day 6 and print it on day 8. | Java 8 | standard input | [
"binary search",
"flows",
"graphs"
] | 08b8dbb6e167db69dc965e8ad4835808 | The first line of input contains two space-separated integers n and k (1ββ€βkββ€βnββ€β2200). The second line contains n space-separated integers a1,β...,βan () β the preparation costs. The third line contains n space-separated integers b1,β...,βbn () β the printing costs. | 2,400 | Output the minimum cost of preparation and printing k problems β that is, the minimum possible sum ai1β+βai2β+β...β+βaikβ+βbj1β+βbj2β+β...β+βbjk, where 1ββ€βi1β<βi2β<β...β<βikββ€βn, 1ββ€βj1β<βj2β<β...β<βjkββ€βn and i1ββ€βj1, i2ββ€βj2, ..., ikββ€βjk. | standard output | |
PASSED | 07051281eea06341195fa8c81b4279bc | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
public static class Pair implements Comparable<Pair> {
int b,e;
int ind;
... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | e5ae48dab469ee456be17e9b0c6377cc | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner r = new Scanner(System.in);
int n = r.nextInt();
int[][] a = new int[n][2];
for(int i = 0; i < n; i++)
for(int j = 0; j < 2; j++)... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 3f76be6e5b85f973ba5228afd959d3c5 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;
public class C_Schedule {
/**
* @param args
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 02eb0584bea2f257bf4bf6a8e924c268 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;
public class C_Schedule {
/**
* @param args
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 6f77b7d5d3e221d9f96516e3320eeffb | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
public class Schedule {
/**
* @param args
*/
static class Section {
int left;
int right;
int index;
static boolean isIntersect(Section a,... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 0cea664be5fe50319e85926deabd1de7 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | //package timus;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.io.Writer;
import java.ma... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 4283e2e0c459db47cd27f3f2ced41a87 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes |
import java.util.*;
public class C
{
public static void main(String[] args)
{
new C(new Scanner(System.in));
}
vect[] vs;
int N;
boolean test(vect p, vect q)
{
if (p.y <= q.x) return false;
if (q.y <= p.x) return false;
return true;
}
ArrayList<Integer> go()
{... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 7ded590cd882f13d0f5e5520d0502f33 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) throws Exception {
in = new Buffer... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 209ab8c7150fd22a3d75ab8fe7ad8517 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.ArrayList;
public class Main {
public static void main(String[] args) throws Exception {
in = new Buffer... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 8e5540c861485655a71c3a36053c023e | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes |
import java.awt.Point;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
session[] A = new session[n];
for (int i = 0; i < n; i++)
... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | b2ba0300354bd2a080c5e9be17dbb90c | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.io.*;
import java.util.*;
public class C implements Runnable {
class Segment implements Comparable<Segment> {
int l, r, id;
public Segment(int l, int r, int id) {
this.l = l;
this.r = r;
this.id = id;
}
@Override
public int compareTo(Segment o) {
if (l < o.l)
return -1;
if ... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 315e0b5f2e75335b17c6623fd76f66ba | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ProblemC {
static class Segment implements Comparable<Segment> {
static int _seq;
int id;
int f;
i... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | fb727d19ef6cd3303948ba4b2757ccae | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main implements Runnable {
class Segment implements Comparable<Segment> {
int l, r, id;
Segment(int l, int r, int id) {
this.l = l;
this.r = r;
this.id = id;
}
public int compareTo(Segment o) {
return l - o.l;
}
}
public void _main() throws... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 859193f6ca108127bcf74755547e0bb9 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | //package round31;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.List;
import java.util.Scanner;
public class C {
private Scanner in;
private PrintWriter out;
// private String INPUT = "3 3 10 20 30 1 3";
// private String INPUT = "4 3 10 2... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 1595d6b72de15dc0a49bf966d293f3ce | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main
{
private static void solve() throws Exception
{
int n = Integer.parseInt(in.readLine());
Seg[] s = new Seg[n];
for (int i = 0; i < n; i++)
{
String[] raw = in.readLine().split("\\s+");
int a = Integer.parseInt(raw[0]);
int b = Integer.parseIn... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 89a8a121afc0ca9494b37567ab288806 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
public class C {
public static boolean intersect(int s1, int e1, int s2, int e2) {
if(s2==e1||s1==e2) return false;
if (s1 <= e2 && s1 >= s2 || s2 <= e1 && s2 >= s1)
return true;
return false;
}
... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 8f3a44491dc8371ed2a74a0c1ac5362c | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes |
import java.io.*;
import java.util.*;
public class CodeForce {
private void solve() throws IOException {
int N = nextInt();
int []L = new int[N + 1];
int []R = new int[N + 1];
for(int i = 0; i < N; i++) {
L[i] = nextInt();
R[i] = nextInt();
}
... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 35afca63c658a5efb8200c842124f543 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
public class Schedule {
/**
* @param args
*/
static class Section {
int left;
int right;
int index;
static boolean isIntersect(Section a,... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | f211ee0323e749bfd87a6407d2d7f90e | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;
public class C {
public static void main(String[] args) {
new C().run();
}
static class Pair {
int index;
Range range;
Pair(int index, Range range) {
this.index = index;
this.range = rang... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 96323922cc9153d4b691cda828e0b0e3 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.ArrayList;
public class Main {
static class dat
{
int ind = 0;
int beg = 0;
int end = 0;
... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 615bb614970bcb51ecfed0f7fb47dab7 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Solution {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
static class Pair implements Comparable<Pair> {
int l, r;
int idx;
public Pair(int l, int r, int idx) {
super();
... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | 1a54a4657df6488cb611263ce0d16904 | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;
public class Main {
public static void main(String[] args) throws IOException {
new Thread(null, new Runnable() {
public vo... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | b5914a6acc94733e45976bb2be99189c | train_001.jsonl | 1285599600 | At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, n groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time of the lesson are known. It has turned out that it is impossible to hold all lessons, becaus... | 256 megabytes |
import java.io.*;
import java.util.Arrays;
import java.util.LinkedList;
import static java.lang.Integer.*;
import static java.lang.Math.*;
@SuppressWarnings("unused")
public class round31C {
static class state implements Comparable<state>{
int start, end, idx;
public state(int st, int en, int i){
star... | Java | ["3\n3 10\n20 30\n1 3", "4\n3 10\n20 30\n1 3\n1 39", "3\n1 5\n2 6\n3 7"] | 2 seconds | ["3\n1 2 3", "1\n4", "0"] | null | Java 6 | standard input | [
"implementation"
] | df28bb63a627a41d67f02cbd927d5e9a | The first line contains integer n (1ββ€βnββ€β5000) β amount of groups, which have lessons in the room 31. Then n lines follow, each of them contains two integers li ri (1ββ€βliβ<βriββ€β106) β starting and finishing times of lesson of the i-th group. It is possible that initially no two lessons intersect (see sample 1). | 1,700 | Output integer k β amount of ways to cancel the lesson in exactly one group so that no two time periods of lessons of the remaining groups intersect. In the second line output k numbers β indexes of groups, where it is possible to cancel the lesson. Groups are numbered starting from 1 in the order that they were given ... | standard output | |
PASSED | c3e042b81719eecf521efb38e876cf90 | train_001.jsonl | 1277823600 | You are given n segments on the Ox-axis. You can drive a nail in any integer point on the Ox-axis line nail so, that all segments containing this point, are considered nailed down. If the nail passes through endpoint of some segment, this segment is considered to be nailed too. What is the smallest number of nails need... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class Problem {
public static void main(String[] arg) {
FastScanner scan = new FastScanner(System.in);... | Java | ["2\n0 2\n2 5", "5\n0 3\n4 2\n4 8\n8 10\n7 7"] | 1 second | ["1\n2", "3\n7 10 3"] | null | Java 7 | standard input | [
"sortings",
"greedy"
] | 60558a2148f7c9741bb310412f655ee4 | The first line of the input contains single integer number n (1ββ€βnββ€β1000) β amount of segments. Following n lines contain descriptions of the segments. Each description is a pair of integer numbers β endpoints coordinates. All the coordinates don't exceed 10000 by absolute value. Segments can degenarate to points. | 1,900 | The first line should contain one integer number β the smallest number of nails needed to nail all the segments down. The second line should contain coordinates of driven nails separated by space in any order. If the answer is not unique, output any. | standard output | |
PASSED | 385d9884dc88ffb871ae71b963a61278 | train_001.jsonl | 1277823600 | You are given n segments on the Ox-axis. You can drive a nail in any integer point on the Ox-axis line nail so, that all segments containing this point, are considered nailed down. If the nail passes through endpoint of some segment, this segment is considered to be nailed too. What is the smallest number of nails need... | 256 megabytes | import java.util.PriorityQueue;
import java.util.Scanner;
public class d22 {
static class P implements Comparable<P> {
int from, to;
public P(int a, int b) {
this.from = Math.min(a, b);
this.to = Math.max(a, b);
}
@Override
public int compareTo(P o) {
return from - o.from;
}
}
public static... | Java | ["2\n0 2\n2 5", "5\n0 3\n4 2\n4 8\n8 10\n7 7"] | 1 second | ["1\n2", "3\n7 10 3"] | null | Java 7 | standard input | [
"sortings",
"greedy"
] | 60558a2148f7c9741bb310412f655ee4 | The first line of the input contains single integer number n (1ββ€βnββ€β1000) β amount of segments. Following n lines contain descriptions of the segments. Each description is a pair of integer numbers β endpoints coordinates. All the coordinates don't exceed 10000 by absolute value. Segments can degenarate to points. | 1,900 | The first line should contain one integer number β the smallest number of nails needed to nail all the segments down. The second line should contain coordinates of driven nails separated by space in any order. If the answer is not unique, output any. | standard output | |
PASSED | 2aeb2b2ad0d8900451836353c85f7605 | train_001.jsonl | 1277823600 | You are given n segments on the Ox-axis. You can drive a nail in any integer point on the Ox-axis line nail so, that all segments containing this point, are considered nailed down. If the nail passes through endpoint of some segment, this segment is considered to be nailed too. What is the smallest number of nails need... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Stack;
/**
* Built using CHelper plu... | Java | ["2\n0 2\n2 5", "5\n0 3\n4 2\n4 8\n8 10\n7 7"] | 1 second | ["1\n2", "3\n7 10 3"] | null | Java 7 | standard input | [
"sortings",
"greedy"
] | 60558a2148f7c9741bb310412f655ee4 | The first line of the input contains single integer number n (1ββ€βnββ€β1000) β amount of segments. Following n lines contain descriptions of the segments. Each description is a pair of integer numbers β endpoints coordinates. All the coordinates don't exceed 10000 by absolute value. Segments can degenarate to points. | 1,900 | The first line should contain one integer number β the smallest number of nails needed to nail all the segments down. The second line should contain coordinates of driven nails separated by space in any order. If the answer is not unique, output any. | standard output | |
PASSED | 1c2e6d64fcbf3060eac220011e876b0f | train_001.jsonl | 1277823600 | You are given n segments on the Ox-axis. You can drive a nail in any integer point on the Ox-axis line nail so, that all segments containing this point, are considered nailed down. If the nail passes through endpoint of some segment, this segment is considered to be nailed too. What is the smallest number of nails need... | 256 megabytes | import java.util.*;
import java.io.*;
public class D0022 {
public static void main(String args[]) throws Exception {
new D0022();
}
D0022() throws Exception {
PandaScanner sc = null;
PrintWriter out = null;
try {
sc = new PandaScanner(System.in);
ou... | Java | ["2\n0 2\n2 5", "5\n0 3\n4 2\n4 8\n8 10\n7 7"] | 1 second | ["1\n2", "3\n7 10 3"] | null | Java 7 | standard input | [
"sortings",
"greedy"
] | 60558a2148f7c9741bb310412f655ee4 | The first line of the input contains single integer number n (1ββ€βnββ€β1000) β amount of segments. Following n lines contain descriptions of the segments. Each description is a pair of integer numbers β endpoints coordinates. All the coordinates don't exceed 10000 by absolute value. Segments can degenarate to points. | 1,900 | The first line should contain one integer number β the smallest number of nails needed to nail all the segments down. The second line should contain coordinates of driven nails separated by space in any order. If the answer is not unique, output any. | standard output | |
PASSED | 5662aa5961a3a13df3ca133079775f94 | train_001.jsonl | 1277823600 | You are given n segments on the Ox-axis. You can drive a nail in any integer point on the Ox-axis line nail so, that all segments containing this point, are considered nailed down. If the nail passes through endpoint of some segment, this segment is considered to be nailed too. What is the smallest number of nails need... | 256 megabytes | import java.util.*;
import java.awt.Point;
public class Segments {
public static void main(String [] args){
Scanner in=new Scanner(System.in);
int n=in.nextInt();
Point array[]=new Point[n];
for(int i=0;i<n;i++){
int a=in.nextInt();
int b=in.nextInt();
array[i]=new Point(Math.min(a,b),Math.max(a,b));
}
Arrays.sort(arra... | Java | ["2\n0 2\n2 5", "5\n0 3\n4 2\n4 8\n8 10\n7 7"] | 1 second | ["1\n2", "3\n7 10 3"] | null | Java 7 | standard input | [
"sortings",
"greedy"
] | 60558a2148f7c9741bb310412f655ee4 | The first line of the input contains single integer number n (1ββ€βnββ€β1000) β amount of segments. Following n lines contain descriptions of the segments. Each description is a pair of integer numbers β endpoints coordinates. All the coordinates don't exceed 10000 by absolute value. Segments can degenarate to points. | 1,900 | The first line should contain one integer number β the smallest number of nails needed to nail all the segments down. The second line should contain coordinates of driven nails separated by space in any order. If the answer is not unique, output any. | standard output | |
PASSED | 0aa72d0736b2600370b8b7feddc850e8 | train_001.jsonl | 1277823600 | You are given n segments on the Ox-axis. You can drive a nail in any integer point on the Ox-axis line nail so, that all segments containing this point, are considered nailed down. If the nail passes through endpoint of some segment, this segment is considered to be nailed too. What is the smallest number of nails need... | 256 megabytes | import java.io.*;
import java.util.*;
public class D22 {
public static void main(String[] args) throws IOException {
input.init(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = input.nextInt();
Pair[] data = new Pair[n];
for(int i = 0; i<n; i++) data[i] = new Pair(input.nextInt(), input.nextInt()... | Java | ["2\n0 2\n2 5", "5\n0 3\n4 2\n4 8\n8 10\n7 7"] | 1 second | ["1\n2", "3\n7 10 3"] | null | Java 7 | standard input | [
"sortings",
"greedy"
] | 60558a2148f7c9741bb310412f655ee4 | The first line of the input contains single integer number n (1ββ€βnββ€β1000) β amount of segments. Following n lines contain descriptions of the segments. Each description is a pair of integer numbers β endpoints coordinates. All the coordinates don't exceed 10000 by absolute value. Segments can degenarate to points. | 1,900 | The first line should contain one integer number β the smallest number of nails needed to nail all the segments down. The second line should contain coordinates of driven nails separated by space in any order. If the answer is not unique, output any. | standard output | |
PASSED | d76bea95a185d49895215b082f74adfe | train_001.jsonl | 1277823600 | You are given n segments on the Ox-axis. You can drive a nail in any integer point on the Ox-axis line nail so, that all segments containing this point, are considered nailed down. If the nail passes through endpoint of some segment, this segment is considered to be nailed too. What is the smallest number of nails need... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class D21 {
private int nailsCount;
private ArrayList<Integer[]> pos = new ArrayList<>();
private int[] overlaps;
private ArrayList<Integer[]> ip = new ArrayList<Integer[]>();
public static void main(String[] args) {
D21 obj = new D21();
obj.i... | Java | ["2\n0 2\n2 5", "5\n0 3\n4 2\n4 8\n8 10\n7 7"] | 1 second | ["1\n2", "3\n7 10 3"] | null | Java 7 | standard input | [
"sortings",
"greedy"
] | 60558a2148f7c9741bb310412f655ee4 | The first line of the input contains single integer number n (1ββ€βnββ€β1000) β amount of segments. Following n lines contain descriptions of the segments. Each description is a pair of integer numbers β endpoints coordinates. All the coordinates don't exceed 10000 by absolute value. Segments can degenarate to points. | 1,900 | The first line should contain one integer number β the smallest number of nails needed to nail all the segments down. The second line should contain coordinates of driven nails separated by space in any order. If the answer is not unique, output any. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.