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
23664df5cc471ff9ef1627663d749f71
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class Towers { public static int min ( int a, int b) { return ( a <= b ) ? a : b; } public static void main ( String[] args ) { Scanner input = new Scanner(System.in); int n; n = input.nextInt(); String[] a = new String[n]...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
2e2fed0296cc4f10afbb374fffe9695a
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashMap; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author P...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
3f73712e2c594fd6007262b63e6b20f9
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.net.ssl.SSLContext; public class Main { static long mod=(long)(1e+9) + 7; static int[] sieve; stat...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
797e991f4b2a84d04184a4d30b99cf1e
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.net.ssl.SSLContext; public class Main { static long mod=(long)(1e+9) + 7; static int[] sieve; stat...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
a68c7f942f5b0418f90b0b1dd4e342e4
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Arrays; public class Solution { //--------------SOLUTION--------------// public static void ma...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
d2980fb6ed67a9154529218afa82804b
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out); int t = 1; Solver s = new Solver(); for (int i = 1; i <= t; i++) { s.solve(i, in,...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
dbfbf3de7ae1167c0b7cc31da13525a8
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.util.*; import java.util.stream.Collectors; public class Main { public static void main(String[] args) { int n; Scanner sc = new Scanner(System.in); n = sc.nextInt(); sc.nextLine(); List<String> l1 = new ArrayList<>(); List<String> l2 = new ArrayList<>(...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
05819f35e4ffc04b0ac828d93cf73698
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { int n; Scanner sc = new Scanner(System.in); n = sc.nextInt(); sc.nextLine(); Map<String,Integer> mp1 = new TreeMap<>((s1, s2) -> { if (s1.length() > s2.length()) { r...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
5aef9a9c992777f0b50ccc24af25bd5c
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author Jenish */ public class Ma...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
bdf2452cc50010f9cbf0e562ebb95543
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
//package com.swiggy.dijkstra; import com.sun.org.apache.bcel.internal.generic.ARRAYLENGTH; import java.awt.event.TextEvent; import java.io.*; import java.util.*; public class ModifyLongest { InputStream is; PrintWriter out; String INPUT = ""; //boolean codechef=true; boolean codechef=true; ...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
f25b8370a6b8e15084dab07d0476621e
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
//CREATED BY : AMBIKESH JHA //NEPAL //Never Give Up Trying... //Code Begins Here import java.io.*; import java.util.*; import java.lang.*; public class Solution{ static final BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static final BufferedWriter out=new BufferedWriter(new OutputSt...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
cd9183ab4b458e4d3ba161bedfc96f82
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class Solution{ static final BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static final BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out)); static int tc; static String[] s; public stati...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
5f1f10807725c502c9070aeddea25529
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
//CREATED BY : AMBIKESH JHA //NEPAL //Never Give Up Trying... //Code Begins Here import java.io.*; import java.util.*; import java.lang.*; public class Solution{ static final BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); static final BufferedWriter out=new BufferedWriter(new OutputSt...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
1ad7530817856af2176347f6a8b56d2e
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.beans.Visibility; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; ...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
d3477989027d6394d4d63f205a9b5802
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.beans.Visibility; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; ...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
b695572f0d55af3ee75d2cfe918bc4fa
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.beans.Visibility; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; ...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
4b9b79059515a0a435f0fe4c29f66618
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; public class tshirts { public static void main(String[] args) throws FileNotFoundException { Scanner sc = new Scanner(System.in); Hash...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
31399121f5324283e5e9b9a37aecde4d
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.util.*; public class Shirts{ public static void main(String[]args){ Scanner s=new Scanner(System.in); int n = s.nextInt();//number of winners. String [] x = new String[n]; String [] y = new String[n]; String [] z = {"XXXS","XXS","XS","S","M","L","XL","XXL","XXXL"}; for(int i=0;i<n;++i) x[i] ...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
04e75a2da60034dd589707e02db639ae
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.util.*; import java.io.*; public class main { public static void main(String args[]) { Scanner sc=new Scanner(System.in); PrintWriter p=new PrintWriter(System.out); ArrayList<String>arr=new ArrayList<>(); int n=sc.nextInt(); String s; for(int i=0;i<n;i...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
562e18e0aa158048b77bed0d3e82e482
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.*; import java.util.*; public class one { static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader() { reader = new BufferedReader(new InputStreamReader(System.in), 32768); tokenizer = null; ...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
f4ebb38fb602ef8d597ad30f57b1ec6a
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.*; import java.util.*; public class one { static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader() { reader = new BufferedReader(new InputStreamReader(System.in), 32768); tokenizer = null; ...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
779250a3d807b1547803bd9946b2e30c
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.Arrays; import java.util.HashSet; import java.util.StringTokenizer; public class e { static long MOD = 1_000_000_007; ...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
af21eb9a0d094ea6c3a1451bc02d2a04
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner r = new Scanner(System.in); int numOfPoints = r.nextInt(); r.nextLong(); Point[] yarra = new Point[numOfPoints]; for(int i = 0; i < numOfPoints; i++) { yarra[i] = new Point(r.nextLong(), r.nextLong()); } ...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
19e67c22f6ebba0f3940c1365fbf7117
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.Collectors; public class E { FastScanner scanner; PrintWriter writer; static class Point implements Comparable<Point> { long x, y; public Point(long x, long y) { this.x = x; this.y = y; } ...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
88857a204b470ebf7a678381751c403b
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
import java.util.*; import java.io.*; import java.awt.*; public class AlyonaTr { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int m = Integer.parseInt(st.nextToken()); ...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
81952bdfad259553c9417fb298fb6b4a
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import static java.lang.Math.abs; import static java.lang.Math.sqrt; import java.util.Scanner; /** * * @author ANDRES */ public c...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
07ab0f3e0698ca808a9e66eb4ae1ce01
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
//package round358; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; public class E2 { InputStream is; PrintWriter out; String INPUT = ""; void so...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
b483d51d02d586a5fddee0ea481236d1
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.*; public class E { private static class Task { void solve(FastScanner in, PrintWriter out) { int N = in.nextInt(); long S = in.nextLong(); Long[][] xy = new Long[N]...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
f0161183c732d0ee301741c36c2457a8
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.*; public class E { private static class Task { void solve(FastScanner in, PrintWriter out) { int N = in.nextInt(); long S = in.nextLong(); Long[][] xy = new Long[N]...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
adcd67637fdbe724c71863ea6d96b127
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
import java.awt.geom.Point2D; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.*; public class E { private static class Task { void solve(FastScanner in, PrintWriter out) { int N = in.nextInt(); long S = in.nextLong(); ...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
c90b0853b132b8e52a1c0e4fc141e662
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; /** * @author Don Li */ public class AlyonaTriangles { void solve() { int n = in.nextInt(); long s = in.nextLong(); ...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
7bb015779353fd108f121b8104bd049a
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import static java.lang.Math.abs; import static java.lang.Math.sqrt; import java.util.Scanner; /** * * @author ANDRES */ public c...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
d198ec93b3f9630eda84f18849492453
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import static java.lang.Math.abs; import static java.lang.Math.sqrt; import java.util.Scanner; /** * * @author ANDRES */ public c...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
9d6e8047126aa92d00257a2a367b4943
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
// package cf.contest682.e; import java.io.PrintWriter; // Trick CF: public class Scanner { private java.io.BufferedReader bufferedReader; private java.util.StringTokenizer stringTokenizer; public Scanner(java.io.InputStream inputStream) { bufferedReader = new java.io.BufferedReader( ...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
aa43ae49c486b73c5442ace28a076bef
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static class Point implements Comparable<Point>{ double x; double y; double t; public Point(double x, double y){ this.x = x; this.y = y; } @Override public int compareTo(Point p){ ...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
0b0c8a94c56d1ac3350c17616a497580
train_002.jsonl
1466181300
You are given n points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these n points, which area exceeds S.Alyona tried to construct a triangle with integer coordinates, which contains all n points and which area doesn't exceed 4S, but, by obvious...
256 megabytes
import java.util.*; import java.io.*; import java.awt.*; public class AlyonaTr { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int m = Integer.parseInt(st.nextToken()); ...
Java
["4 1\n0 0\n1 0\n0 1\n1 1"]
3 seconds
["-1 0\n2 0\n0 2"]
Note
Java 8
standard input
[ "two pointers", "geometry" ]
d7857d3e6b981c313ac16a9b4b0e1b86
In the first line of the input two integers n and S (3 ≤ n ≤ 5000, 1 ≤ S ≤ 1018) are given — the number of points given and the upper bound value of any triangle's area, formed by any three of given n points. The next n lines describes given points: ith of them consists of two integers xi and yi ( - 108 ≤ xi, yi ≤ 108)...
2,600
Print the coordinates of three points — vertices of a triangle which contains all n points and which area doesn't exceed 4S. Coordinates of every triangle's vertex should be printed on a separate line, every coordinate pair should be separated by a single space. Coordinates should be an integers not exceeding 109 by ab...
standard output
PASSED
181acf4ab267eb2a1a7504a4c0f5e1d5
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.util.*; import java.io.*; public class a implements Runnable { PrintWriter out; public void main() throws Throwable { FastScanner in = new FastScanner(System.in); out = new PrintWriter(System.out); int n = in.nextInt(); int k = in.nextInt(); ...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
884318bcea32250be3def1b65c371278
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.PriorityQueue; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @au...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
62425d51790fb23a9f5b25ead05f8b58
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 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.PriorityQueue; import java.io.IOException; import java.util.stream.Collectors; import java.io.InputStreamReader; import java.util....
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
616c8c5b6826f5c92fbd03c725ca15fe
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.PriorityQueue; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; import java.io.OutputSt...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
00d63263d347cfffca338e2822086a45
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.OutputStream; import java.util.*; public class Planning { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub Reader sc = new ...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
7db709d3a99e189d0a99ba3f86d9fee7
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import javax.accessibility.AccessibleRole; import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class TaskE implements Runnable { PrintWriter w ; InputReader c; public void run() { c = new InputReader(...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
9f0e86fece62e2e080bd4eb02e88c54e
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; import java.util.ArrayList; import java.util.PriorityQueue; public class Solution { // A7A A7A A7A A7A A7A A7A A7A A7A A7A A7A A7A ...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
0ab394a51e3dc391bcb7d3233cc3bea7
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; import java.util.ArrayList; import java.util.PriorityQueue; public class Solution { // A7A A7A A7A A7A A7A A7A A7A A7A A7A A7A A7A ...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
321c01bf8e857441b7e61738638144e4
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.PriorityQueue; import java.util.AbstractQueue; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundExce...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
ad072c897dadf12e80bb57e2c021a475
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.TreeSet; import java.io.File; import java.io.FileNotFoundException; import...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
af3b1e0c04f53a937b6ac555b9115f5a
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.*; import java.util.PriorityQueue; public class CAirport { private static final String REGEX = " "; private static final Boolean DEBUG = false; private static final String FILE_NAME = "input.txt"; public static void main(String[] args) throws IOException { if (DEBUG) { generate(); ...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
2d2ee026e2f8b998f7f2557b662488b4
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.util.*; import java.io.*; public class planning { static class plan implements Comparable<plan>{ int p; int n; public plan(int p, int n) { this.p = p; this.n = n; } @Override public int compareTo(plan t) { return this.p-t.p; } ...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
011db5b9c99dd8a5b65b952d938bb272
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.PriorityQueue; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using ...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
ca47b152938af620db93934684f8562b
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
//>>>BaZ<<<// import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static int dx[] = {-1,1,0,0}; static int dy[] = {0,0,1,-1}; static long MOD = 1000000007; static int INF = Integer.MAX_VALUE/10; static PrintWriter pw; static Reader scan; static int ni(...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
182c72942b8ba2575c23e92b184e1115
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.PriorityQueue; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.I...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
374fe6ba9816e83f3bd942c2f490329d
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.*; import java.util.*; public class A { static class Plane implements Comparable<Plane> { int cost; int id; @Override public int compareTo(Plane o) { return -Integer.compare(cost, o.cost); } public Plane(int cost, int id) { this.cost = cost; this.id = id; } } void submit...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
75dba2b234eee8e3b680e987a0601489
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.PriorityQueue; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.I...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
7465f4bb128144decef280e49592649b
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 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.Comparator; import java.util.PriorityQueue; import java.util.StringTokenizer; public class Div1_433A { static Int...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
14b43bb2c4b8875875cee4f3d9b785cd
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.PriorityQueue; import java.util.Scanner; import java.util.StringTokenizer; public class Planning1 { /** * @param args */ static boolean[] condition; static int[] brr; publ...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
bb5ff69998153a9974ebbbd808a7e846
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static class Reader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} public int read() {if (nu...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
0e7869b633141099092bd8bdf125adcd
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.*; import java.util.*; import static java.lang.Integer.parseInt; import static java.lang.System.out; import static java.util.stream.Collectors.*; import static java.util.Arrays.*; public class Main { public static void main(String[] __) throws IOException { BufferedReader in = new BufferedR...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
f0681737e6ff16ec3abb08533b46dcd5
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.NoSuchElementException; import java.util.Objects; impo...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
7c8b204ff12c097fe40898502d6b5d5b
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Comparator; import java.util.PriorityQueue; import java.util.StringTokenizer; public cla...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
8ef507993bb9133936b031779e27de0d
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; import java.util.Map.Entry; import static java.lang.Math.*; public class A extends PrintWriter { void run() { int n = nextInt(), k = nextInt(); long[] c = new long[n]; for (int i = 0; i < n; i++) { c[i] = nex...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
b5dd1eab1cfb4f2a9f4d5367d0b5359d
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.io.*; import java.util.LinkedList; import java.util.PriorityQueue; import java.util.StringTokenizer; import java.util.TreeSet; public class Main { static MyScanner in; static PrintWriter out; public static void main(String[] args) throws IOException { in = new MyScanner(); o...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
2ef6403e5572939f1c2e433dbb754af6
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.util.*; import java.io.*; import java.util.*; public class test { /* private static class IntegerPair implements Comparable { public Integer first; public Integer second; public IntegerPair(Integer f, Integer s) { first = f; second = s; } public int compareTo(Object obj) ...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
187c6ddabd378211b14f1662795deec5
train_002.jsonl
1504702500
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metropolia, so it is difficult to keep the schedule intact. This is exa...
512 megabytes
import java.util.*; import java.io.*; import java.util.*; public class test { /* private static class IntegerPair implements Comparable { public Integer first; public Integer second; public IntegerPair(Integer f, Integer s) { first = f; second = s; } public int compareTo(Object obj) ...
Java
["5 2\n4 2 1 10 2"]
1 second
["20\n3 6 7 4 5"]
NoteLet us consider sample test. If Helen just moves all flights 2 minutes later preserving the order, the total cost of delaying the flights would be (3 - 1)·4 + (4 - 2)·2 + (5 - 3)·1 + (6 - 4)·10 + (7 - 5)·2 = 38 burles. However, the better schedule is shown in the sample answer, its cost is (3 - 1)·4 + (6 - 2)·2 + (...
Java 8
standard input
[ "greedy" ]
8c23fcc84c6921bc2a95ff0586516321
The first line contains two integers n and k (1 ≤ k ≤ n ≤ 300 000), here n is the number of flights, and k is the number of minutes in the beginning of the day that the flights did not depart. The second line contains n integers c1, c2, ..., cn (1 ≤ ci ≤ 107), here ci is the cost of delaying the i-th flight for one min...
1,500
The first line must contain the minimum possible total cost of delaying the flights. The second line must contain n different integers t1, t2, ..., tn (k + 1 ≤ ti ≤ k + n), here ti is the minute when the i-th flight must depart. If there are several optimal schedules, print any of them.
standard output
PASSED
944956f2314dad5393a0e473aa82c4b4
train_002.jsonl
1441526400
Bananistan is a beautiful banana republic. Beautiful women in beautiful dresses. Beautiful statues of beautiful warlords. Beautiful stars in beautiful nights.In Bananistan people play this crazy game – Bulbo. There’s an array of bulbs and player at the position, which represents one of the bulbs. The distance between t...
256 megabytes
import java.util.Scanner; public class F { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int xl = s.nextInt(); int xr = xl; int[] start = new int[n]; int[] end = new int[n]; for (int i = 0; i < n; i++) { ...
Java
["5 4\n2 7\n9 16\n8 10\n9 17\n1 6"]
1 second
["8"]
NoteBefore 1. turn move to position 5Before 2. turn move to position 9Before 5. turn move to position 8
Java 7
standard input
[ "dp", "greedy" ]
2452c30e7820ae2fa9a9ff4698760326
The first line contains number of turns n and initial position x. Next n lines contain two numbers lstart and lend, which represent that all bulbs from interval [lstart, lend] are shining this turn. 1 ≤ n ≤ 5000 1 ≤ x ≤ 109 1 ≤ lstart ≤ lend ≤ 109
2,100
Output should contain a single number which represents the best result (minimum cost) that could be obtained by playing this Bulbo game.
standard output
PASSED
a9d863a403effa88e8b29d3a8e01079a
train_002.jsonl
1441526400
Bananistan is a beautiful banana republic. Beautiful women in beautiful dresses. Beautiful statues of beautiful warlords. Beautiful stars in beautiful nights.In Bananistan people play this crazy game – Bulbo. There’s an array of bulbs and player at the position, which represents one of the bulbs. The distance between t...
256 megabytes
import java.util.Scanner; import java.util.TreeMap; import java.util.TreeSet; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Hashtable; import java.util.Inp...
Java
["5 4\n2 7\n9 16\n8 10\n9 17\n1 6"]
1 second
["8"]
NoteBefore 1. turn move to position 5Before 2. turn move to position 9Before 5. turn move to position 8
Java 7
standard input
[ "dp", "greedy" ]
2452c30e7820ae2fa9a9ff4698760326
The first line contains number of turns n and initial position x. Next n lines contain two numbers lstart and lend, which represent that all bulbs from interval [lstart, lend] are shining this turn. 1 ≤ n ≤ 5000 1 ≤ x ≤ 109 1 ≤ lstart ≤ lend ≤ 109
2,100
Output should contain a single number which represents the best result (minimum cost) that could be obtained by playing this Bulbo game.
standard output
PASSED
8c3f85b89bf69c3518b051a408ec0e55
train_002.jsonl
1441526400
Bananistan is a beautiful banana republic. Beautiful women in beautiful dresses. Beautiful statues of beautiful warlords. Beautiful stars in beautiful nights.In Bananistan people play this crazy game – Bulbo. There’s an array of bulbs and player at the position, which represents one of the bulbs. The distance between t...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Bit...
Java
["5 4\n2 7\n9 16\n8 10\n9 17\n1 6"]
1 second
["8"]
NoteBefore 1. turn move to position 5Before 2. turn move to position 9Before 5. turn move to position 8
Java 7
standard input
[ "dp", "greedy" ]
2452c30e7820ae2fa9a9ff4698760326
The first line contains number of turns n and initial position x. Next n lines contain two numbers lstart and lend, which represent that all bulbs from interval [lstart, lend] are shining this turn. 1 ≤ n ≤ 5000 1 ≤ x ≤ 109 1 ≤ lstart ≤ lend ≤ 109
2,100
Output should contain a single number which represents the best result (minimum cost) that could be obtained by playing this Bulbo game.
standard output
PASSED
2f23aca5b4a57e17c58183db57f72cb1
train_002.jsonl
1441526400
Bananistan is a beautiful banana republic. Beautiful women in beautiful dresses. Beautiful statues of beautiful warlords. Beautiful stars in beautiful nights.In Bananistan people play this crazy game – Bulbo. There’s an array of bulbs and player at the position, which represents one of the bulbs. The distance between t...
256 megabytes
import java.util.*; import java.util.Map.Entry; import java.io.*; import java.lang.*; import java.math.*; import static java.lang.Math.*; public class Solution implements Runnable { void solve() throws Exception { int n = sc.nextInt() + 1; int[] l = new int[n]; int[] r = new int[n]; l[0] = r...
Java
["5 4\n2 7\n9 16\n8 10\n9 17\n1 6"]
1 second
["8"]
NoteBefore 1. turn move to position 5Before 2. turn move to position 9Before 5. turn move to position 8
Java 7
standard input
[ "dp", "greedy" ]
2452c30e7820ae2fa9a9ff4698760326
The first line contains number of turns n and initial position x. Next n lines contain two numbers lstart and lend, which represent that all bulbs from interval [lstart, lend] are shining this turn. 1 ≤ n ≤ 5000 1 ≤ x ≤ 109 1 ≤ lstart ≤ lend ≤ 109
2,100
Output should contain a single number which represents the best result (minimum cost) that could be obtained by playing this Bulbo game.
standard output
PASSED
0a5c82404a77b7afa73924e74936e510
train_002.jsonl
1441526400
Bananistan is a beautiful banana republic. Beautiful women in beautiful dresses. Beautiful statues of beautiful warlords. Beautiful stars in beautiful nights.In Bananistan people play this crazy game – Bulbo. There’s an array of bulbs and player at the position, which represents one of the bulbs. The distance between t...
256 megabytes
import java.util.*; import java.io.*; import java.awt.Point; import java.math.BigDecimal; import java.math.BigInteger; import static java.lang.Math.*; // Solution is at the bottom of code public class F implements Runnable{ final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader...
Java
["5 4\n2 7\n9 16\n8 10\n9 17\n1 6"]
1 second
["8"]
NoteBefore 1. turn move to position 5Before 2. turn move to position 9Before 5. turn move to position 8
Java 7
standard input
[ "dp", "greedy" ]
2452c30e7820ae2fa9a9ff4698760326
The first line contains number of turns n and initial position x. Next n lines contain two numbers lstart and lend, which represent that all bulbs from interval [lstart, lend] are shining this turn. 1 ≤ n ≤ 5000 1 ≤ x ≤ 109 1 ≤ lstart ≤ lend ≤ 109
2,100
Output should contain a single number which represents the best result (minimum cost) that could be obtained by playing this Bulbo game.
standard output
PASSED
2a67edb8a4c9355c847befa10efe17d3
train_002.jsonl
1441526400
Bananistan is a beautiful banana republic. Beautiful women in beautiful dresses. Beautiful statues of beautiful warlords. Beautiful stars in beautiful nights.In Bananistan people play this crazy game – Bulbo. There’s an array of bulbs and player at the position, which represents one of the bulbs. The distance between t...
256 megabytes
import java.util.*; import java.io.*; import java.awt.Point; import java.math.BigDecimal; import java.math.BigInteger; import static java.lang.Math.*; // Solution is at the bottom of code public class F implements Runnable{ final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null; BufferedReader...
Java
["5 4\n2 7\n9 16\n8 10\n9 17\n1 6"]
1 second
["8"]
NoteBefore 1. turn move to position 5Before 2. turn move to position 9Before 5. turn move to position 8
Java 7
standard input
[ "dp", "greedy" ]
2452c30e7820ae2fa9a9ff4698760326
The first line contains number of turns n and initial position x. Next n lines contain two numbers lstart and lend, which represent that all bulbs from interval [lstart, lend] are shining this turn. 1 ≤ n ≤ 5000 1 ≤ x ≤ 109 1 ≤ lstart ≤ lend ≤ 109
2,100
Output should contain a single number which represents the best result (minimum cost) that could be obtained by playing this Bulbo game.
standard output
PASSED
46319d40e1b1eb3ba6ad2c1b2c2e2090
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner reader = new Scanner(System.in); int n = reader.nextInt(); int[][] board = new int[n][n]; //automatically initialized with '0' int row = 0; int col = n/2; int num =...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
9fe5ec2dd871e7b2f73e3eeeb9893062
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.InputMismatchException; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; import java.util.Stack; import java.io.BufferedWriter; import j...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
dff6e9caf6aa32e0fac60a5c564d776e
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
//package acm.cf1; import java.util.*; public class Main { static int odd,even; static int nextodd(){ odd+=2; return odd; } static int nexteven(){ even+=2; return even; } static void output(int a[][],int n){ // System.out.println("???"); for (int i = 1;i <= n;++i){ for (int j = 1;j <= n;++j){ // ...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
9f3366544540fe3838b92edf8e1684a5
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.*; import java.io.*; import java.text.*; /** * * @author alanl */ public class Main{ static BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
f0b94cc81f289c373649a5fceb013ea8
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.*; public class problem710C { public static void main(String[] args) { Scanner console = new Scanner(System.in); int size = console.nextInt(); if (size == 1) { System.out.println("1"); return; } PriorityQueue<Integer> odd = new PriorityQueue<>(); PriorityQueue<Integer> even = new Pr...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
4ebc58661dbaca6e3b5eaeaa45f93c2a
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception{ BufferedReader inp = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(inp.readLine()); int r = n >>> 1; as...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
b506df4c2c36d37f186528058592f4ba
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.Scanner; public class C{ public static void main( String[] args ){ Scanner scanner = new Scanner( System.in ); int n = scanner.nextInt( ); int[][] m = new int[n][n]; for( int i = 0; i < n; ++i ){ for( int j = 0; j < n; ++j ){ m[i][j] = n * i + j + 1; } } for( int i = ( ( n + 1 ...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
e9038c9b7a96d8711b1126848d148642
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { static int MOD = 1000000007; // After writing solution, quick scan for: // array out of bounds // special cases e.g. n=1? // // Big numbers arithmetic bugs: // int overflow // sorting, or tak...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
b7889c1a1bf2b6a45dd926f621265b36
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
/** * Created by ankeet on 8/22/16. */ import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class C710 { static FastReader in = null; static PrintWriter out = null; public static void solve() ...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
94de295e648b5b4cd126ca518c9a327d
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class CF710C { public static void main(String[] args) throws FileNotFoundException { InputStream inputStream = System.in; // InputStream inputStream = new FileInputStream(new File("input")); OutputStream outputStream = System.out; InputReader in = new ...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
6c115d753c0db796ca5926e6f6e5aa5e
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { static void generateSquare(int n) { int[][] magicSquare = new int[n][n]; // Initialize position for 1 int ...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
b2934c4e84770f97ea6ec59e09d8cb8b
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.*; import java.util.*; public class Sweata { // Function to generate odd sized magic squares static void generateSquare(int n) { int[][] magicSquare = new int[n][n]; // Initialize position for 1 int i = n/2; int j = n-1; // ...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
9809c1441c2efe20740b9131dcc2c087
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Task710C { public static void main(String[] args) throws IOException { InputScanner is = new InputScanner(); int n = is.nextInt(); int ans[][] = new ...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
175ef9584f0eb30fd108f9490594c250
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
/* * For the brave souls who get this far: You are the chosen ones, * the valiant knights of programming who toil away, without rest, * fixing our most awful code. To you, true saviors, kings of men, * I say this: never gonna give you up, never gonna let you down, * never gonna run around and desert you. Never gon...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
d761a99a8614cf56e8c234d72283e6f2
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.Scanner; public class MagicOddSquare { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); int counter=0; int n = input.nextInt(); int val =1; int x1 = n/2; int x2 = n/2; int y = 0; int value= 1; int[][] arr = new ...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
698fbbda1fffba63792e71e11589e1e1
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static class Reader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} public int read() {if (nu...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
77b3f03036e3385afc2c62994dbd1eb1
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.util.ArrayDeque; import java.util.NoSuchElementException; import java.util.Queue; import static java.lang.Math.*; public class Main { public static void main(String[] args) { FastScanner fs = new FastScanner(); int n = fs.nextInt(...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
ba44ac985b59cf58c0a096abdcb48906
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class q1 { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(in.readLine()); in...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
e062854a557f1b8f3c2ff42fd08bdfb7
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.Scanner; public class C710B { public static void main(String[] args) { Scanner sc=new Scanner(System.in); short n=sc.nextShort(),c=2,nc=1,l=0; if(n%2==0) for (short i = 0; i < n; i++) { for (short j = 1; j <= n; j++) { System.out.print(i*n...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
1cd98bc6b88a2ae4814c228b7e4396f9
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.Scanner; public class C710B { public static void main(String[] args) { Scanner sc=new Scanner(System.in); short n=sc.nextShort(),c=2,nc=1,l=0; for (short i = 0; i < n; i++) { for (int j = 0; j < n; j++) if(j<=n/2+l&&j>=n/2-l){ ...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
736618581df1bd3a800c6a35e47ce476
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class templ { int binarySearch(int arr[], int l, int r, int x) { if (r >= l) { int mid = l + (r - l)/2; if (arr[mid] == x) return mid; if (arr[mid] > x) return binary...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
c5251c18d85937bd5a6dc66d9db553c9
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int odd=1; int even=2; int x=1; if(n==1) System.out.println(1); else {for (int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(j<=n/2+i &&j >=n/2-i && i<=n/2...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
a4c1c1d59e4b6762df2832d252369a21
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int odd=1; int even=2; int x=1; if(n==1) System.out.println(1); else {for (int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(j<=(n/2)+i &&j >=(n/2)-i && i<...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
c05c6a244bce30a367be9e3ac60a2248
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); sc.close(); int limit = N*N; int[][] mat = new int[N][N]; int idx = 0; ArrayList<Integer> odd = new ArrayList<>();...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
8edf2cf41d03d369ba107e3cee7661d7
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.StringTokenizer; import java.math.BigInteger;...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
1e176a2f99a1bcb1a892f38d4e9c6314
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.*; public class oddsqr2 { public static void main(String args[]) { try{ Scanner s=new Scanner(System.in); int n=s.nextInt(); int a[][]=new int[n][n]; int p = (int)(n/2); int m=(n-1)/2; int g=(m%2); if(g==1) { int k=2; int h=1; for(int i=0;i<n;i++) { if(i==p) ...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
b13bd049abb54ab15d010ae34d301901
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.Scanner; public class oddsqr2 { public static void main(String args[]) { try{ Scanner s=new Scanner(System.in); int n=s.nextInt(); int a[][]=new int[n][n]; int p = (int)(n/2); int m=(n-1)/2; int g=(m%2); if(g==1) { int k=2; int h=1; for(int i=0;i<n;i++) { if(i=...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
086a2e3a13b5d3b7e500de979d198eae
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.*; public class C { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int odd = 0, even = 1; int arr[][] = new int[n][n]; StringBuilder sb = new StringBuilder(); if(n>1){ for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(arr[i][j...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
6b944e0ed129d4352102d4b61a0885cc
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.util.*; public class C { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int odd = 0, even = 1; int arr[][] = new int[n][n]; StringBuilder sb = new StringBuilder(); for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(arr[i][j]!=0) conti...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
58479e2b150e917628937514d6171f0e
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; // the difference (in each row/column/main diagonal) // between the number of odds and the number of evens should be an odd number. /* 0 1 0 1 1 1 ...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output
PASSED
9555781e5f27dfe5ea3523d044690e98
train_002.jsonl
1471875000
Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.PriorityQueue; public class magicoddsquare { public static void main(String[] args) throws Exception { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); PrintWriter w = new P...
Java
["1", "3"]
1 second
["1", "2 1 4\n3 5 7\n6 9 8"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
a7da19d857ca09f052718cb69f2cea57
The only line contains odd integer n (1 ≤ n ≤ 49).
1,500
Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.
standard output