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 | f3d7e7325064cd80408ed9ac71498fa4 | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public stat... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | 48c4b82b52a03211cd02de3fe0403da4 | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.io.*;
import java.util.Locale;
import java.util.StringTokenizer;
public class CodeParsing implements Runnable {
void solve() throws IOException {
String s = readString();
int x = 0;
for (int i = 0; i < s.length(); i ++) {
char c = s.charAt(i);
if (c ==... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | d419e12c7783ba581cd7e6c6644ea389 | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.io.*;
import java.util.*;
public class Example {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine());
} catch (Exception e) {
... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | 3cd0ecec7e5535cd6ed242650605eeb3 | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | //package example;
import java.io.*;
import java.util.*;
public class Example {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String next() {
while (st == null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine());
} catch (... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | 7dc3efed02bbdd4335211452be5e3abf | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.util.Scanner;
public class ParseCode {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s=sc.nextLine();
int x;
int y=0;
for(int i=0;i<s.length();i++){
if(s.charAt(i)=='y'){
y++;//n
}
}
x=s.length()-y;
if(x>y)... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | 8d2f41eb1956dfa03f904e59993feaf7 | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.io.IOException;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.TreeSet;
import java.util.ArrayList;
import java.u... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | 1d1385b2eb861ac54fb35a2dd0322362 | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.io.*;
public class CF156B {
/**
* @param args
* @throws java.io.IOException
*/
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
char[] chars = br.readLine().toCharArray();
... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | 36900cabceae3e9fddb83a2187f6db1c | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.util.*;
public class cf255b {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = 0, y = 0;
for(char z : in.next().trim().toCharArray())
if(z=='x') x++;
else y++;
int v = Math.min(x,y);
x -= v;
y -= v;
StringBuilder sb = new StringB... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | 639752077d5f9066535c06b44aacfd60 | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.StringBuilder;
public class Solution255B {
public static void main(String[] args) {
//Scanner sc = new Scanner(System.in);
MyScanner sc = new MyScanner();
String line = sc.nextLine();
int countX = 0;
int countY = 0;
for (int i = 0 ; i < line.leng... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | fc3d3026ce54676efa5568d786366333 | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Scanner;
public class B {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in=new Scanner(new InputStreamReader(System.in));
PrintWriter out... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | c3af3bc50aeb22dab673b455d7357e2c | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static BufferedReader br;
static StringTokenizer st;
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
String str = br.readLine();
int num = 0;
for(int i = 0; i < str.length(... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | b8372c0f309f60f55879a6a90b86caf5 | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static long rotateRight(long n, int i) {
return Long.rotateRight(n, 32 + i);
}
public static long xor(long a, long b) {
return a ^ b;
}
public static void main(String[] args) throws Exception {
FastScanner kb = new FastScanner(System.in);
... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | 9ec9a779d4dac63e56b93b6b61d065a3 | train_001.jsonl | 1355671800 | Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string s, consisting of characters "x" and "y", and uses two following operations at runtime: Find two consecutive characters in the string, such that the first of them equals "y", and the second... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class BB {
static StringTokenizer st;
static BufferedReader in;
public st... | Java | ["x", "yxyxy", "xxxxxy"] | 2 seconds | ["x", "y", "xxxx"] | NoteIn the first test the algorithm will end after the first step of the algorithm, as it is impossible to apply any operation. Thus, the string won't change.In the second test the transformation will be like this: string "yxyxy" transforms into string "xyyxy"; string "xyyxy" transforms into string "xyxyy"; string "... | Java 6 | standard input | [
"implementation"
] | 528459e7624f90372cb2c3a915529a23 | The first line contains a non-empty string s. It is guaranteed that the string only consists of characters "x" and "y". It is guaranteed that the string consists of at most 106 characters. It is guaranteed that as the result of the algorithm's execution won't be an empty string. | 1,200 | In the only line print the string that is printed as the result of the algorithm's work, if the input of the algorithm input receives string s. | standard output | |
PASSED | f54dbda12163727e8e37e739cafa08eb | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.InputMismatchException;
... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | d413e8e7bea645ff4b7c610334d86e19 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class B {
FastScanner scanner;
PrintWriter writer;
void solve() throws IOException {
scanner = new FastScanner(System.in);
writer = new PrintWriter(System.out);
int n = scanner.nextInt();
long b = 0;
long... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 82c06e6261b900a8be4aef35de8190a4 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Locale;
import java.util.StringTokenizer;
public class Solution implements Runn... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 94eaeeca11b65acac08e991b2f714ed2 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import static java.lang.Math.*;
public class B {
public Object solve () {
int N = sc.nextInt();
int [] A = sc.nextInts();
long B = 0, W = 0;
for (int i : rep(N))
if (i % 2 == 0) {
long b = A[i] / 2, w = A[i] - b;
B += b; W += w;
}
else {
long w = A[i] / 2, b = A[i] - w;
B += b; W +=... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 10e621204725b902e8187ec28d274f14 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class cf1 {
static long mod = (long)1e9 + 7;
static long mod1 = 998244353;
static FastScanner f;
static PrintWriter pw = new PrintWriter(System.out);
static Scanner S = new Scanner(System.in);
static long x0; static long y... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 0a619840aa17ec1c30e7ea531ec293bf | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.util.*;
import java.io.*;
public class B{
static PrintWriter out;
static InputReader in;
public static void main(String args[]){
out = new PrintWriter(System.out);
in = new InputReader();
new B();
out.flush(); out.close();
}
B(){
solve();
}
... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 851e7b2d2e2cd659bc396228aa0a87d0 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;
/**
* Built using CHelper p... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 22d40ca970b881eadc6e2fdcc5bf581a | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes |
public class Main {
private static void solve() {
int n = ni();
int[] a = na(n);
System.out.println(Math.max(f(a, true), f(a, false)));
}
private static long f(int[] a, boolean flg) {
int n = a.length;
long ret = 0;
long sum = 0;
for (int i = 0; i < n; i++) {
int x = a[i] +... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 39cb8c92272a3663dc555476dab500f0 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long t=2;
long[] arr=new long[n];
int f=-1,p=-1;
long ans=0;
for(int i=1;i<=n;i++)
{
long x=sc.nextInt();
if(p==-1)
arr[++p]=x;
else
... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | be81ac28910f9c90bb5a28894dd1d6bc | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | // package Quarantine;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class DominoForYoung {
public static void main(String[] args)throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.i... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | e08d61ed79f1a34114e1793639a3dfac | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class BTask {
private static final String QUICK_ANSWER = "NO";
private final Input in;
private final StringBuilder out;
public BTask(Input in, StringBuilder out) {
this.in = in;
this.out = out;
}
public void solve() th... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | ffef7fc12018a8fa1f83d56ff6213fec | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Random;
import j... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 2a875f8401a06334192113238f667f53 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;
/**
* Built using CHelper p... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 439aebc4377898923f2770536389cb4e | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.util.Scanner;
public class DominoForYoung {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long[] arr = new long[n];
for (int i = 0; i < n; i++) {
arr[i] = in.nextLong();
}
long[] bipartite = new long[2];
for (int i = 0; i < n; i++) {
... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 2c77e996b3f5f20f8f40c1c1f6bf2867 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.*;
import java.util.*;
public class C324C
{
private static StringTokenizer st;
public static void nextLine(BufferedReader br) throws IOException
{
st = new StringTokenizer(br.readLine());
}
public static int nextInt()
{
return Integer.parseInt(st.nextToken(... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 5fb51c360ab574b6019791b3d39e24df | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.util.*;
import java.io.*;
public class EdB {
public static void main(String[] args) throws Exception{
int num = 998244353;
// TODO Auto-generated method stub
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
// String inp... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | d403c243b6e859fe4337fba7cac4c842 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Solution {
public static void main(String args[]) throws Exception {
BufferedReader br = new BufferedReader(new InputStrea... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 898764ed18a54e9c207fbc1fa5043c07 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
*
* @author kaixi_000
*/
public class Cf1268B {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
B... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | de69d9479ce93e2a2b4c2a18ce0946dd | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.util.*;
import java.io.*;
public class b {
public static void main(String[] args){
JS scan = new JS();
int n = scan.nextInt();
int[] a = new int[n+1];
long[] x = new long[2];
for(int i = 0; i < n; i++){
a[i] = scan.nextInt();
x[i%2] += a[i]/2;
x[(i+1)%2] += a[i]/2;
x[i%2] += a[i]%2;... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 798ede5625ddb159a8f57bbe6f15c7bf | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | //package com.company;
import java.io.*;
import java.util.*;
public class Main {
public static class Task {
public void solve(Scanner sc, PrintWriter pw) throws IOException {
int n = sc.nextInt();
long tot = 0;
long cnt = 0;
for (int i = 0; i < n; i++) {
... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 2c3b131737da47767758e35dcb0798e4 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | b5ac236f6a1c36508f95a682330d3a32 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | /**
* BaZ :D
*/
import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class ACMIND
{
static FastReader scan;
static PrintWriter pw;
static long MOD = 1_000_000_007 ;
static long INF = 1_000_000_000_000_000_000L;
static long inf = 2_000_000_000;
public static void main(S... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 99d5ece8dfbd46b563b8631820bf44f1 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
//SOLUTION BEGIN
//Into the Hardware Mode
void pre() throws Exception{}
void solve(int TC)throws Exception{
int n = ni();
long a = 0, b = 0;
for(int i = 0; i< n; i++){
long x = nl();
... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 83f026327d616217e86d8cc3c8516b2e | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | //package round609;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class B2 {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
in... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | ee7752d769c7d7d65daa4b82b1d66230 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.*;
import java.util.Random;
import java.math.BigInteger;
import java.util.*;
public class test {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
PrintWriter out = new PrintWriter(outputStream);
InputReader... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 1b843fa4c2eed42d2235ba845e5a045b | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main (String[] args) { new A(); }
A() {
Scanner s = new Scanner(System.in);
System.err.println("");
int n = s.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++) a[i] = s.nextInt();
long[] cnt = new long[2];
for(int i =... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | 1d8e9268e59012ee0969a088f13306b0 | train_001.jsonl | 1576926300 | You are given a Young diagram. Given diagram is a histogram with $$$n$$$ columns of lengths $$$a_1, a_2, \ldots, a_n$$$ ($$$a_1 \geq a_2 \geq \ldots \geq a_n \geq 1$$$). Young diagram for $$$a=[3,2,2,2,1]$$$. Your goal is to find the largest number of non-overlapping dominos that you can draw inside of this histogra... | 256 megabytes | import java.util.*;
public class CodeForces1268B{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
long blue = 0;
long red = 0;
for(int i = 0;i<n;i++){
int a = input.nextInt();
if(i % 2 == 0){
blue+= a/2;
red+= (a+1)/2;
}
else{
... | Java | ["5\n3 2 2 2 1"] | 3 seconds | ["4"] | NoteSome of the possible solutions for the example: | Java 8 | standard input | [
"dp",
"greedy",
"math"
] | 6ac3246ee9cf78d81f96a3ed05b35918 | The first line of input contain one integer $$$n$$$ ($$$1 \leq n \leq 300\,000$$$): the number of columns in the given histogram. The next line of input contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 300\,000, a_i \geq a_{i+1}$$$): the lengths of columns. | 2,000 | Output one integer: the largest number of non-overlapping dominos that you can draw inside of the given Young diagram. | standard output | |
PASSED | af79304702c0f48f5e31d2b546722eb5 | train_001.jsonl | 1410103800 | Peter had a cube with non-zero length of a side. He put the cube into three-dimensional space in such a way that its vertices lay at integer points (it is possible that the cube's sides are not parallel to the coordinate axes). Then he took a piece of paper and wrote down eight lines, each containing three integers — c... | 256 megabytes |
// Imports
import java.util.*;
import java.io.*;
public class B464 {
/**
* @param args the command line arguments
* @throws IOException, FileNotFoundException
*/
public static void main(String[] args) throws IOException, FileNotFoundException {
// TODO UNCOMMENT WHE... | Java | ["0 0 0\n0 0 1\n0 0 1\n0 0 1\n0 1 1\n0 1 1\n0 1 1\n1 1 1", "0 0 0\n0 0 0\n0 0 0\n0 0 0\n1 1 1\n1 1 1\n1 1 1\n1 1 1"] | 1 second | ["YES\n0 0 0\n0 0 1\n0 1 0\n1 0 0\n0 1 1\n1 0 1\n1 1 0\n1 1 1", "NO"] | null | Java 11 | standard input | [
"geometry",
"brute force"
] | 55da4611bc78d55c228d0ce78bd02fd3 | Each of the eight lines contains three space-separated integers — the numbers written on the piece of paper after Nick's mischief. All numbers do not exceed 106 in their absolute value. | 2,000 | If there is a way to restore the cube, then print in the first line "YES". In each of the next eight lines print three integers — the restored coordinates of the points. The numbers in the i-th output line must be a permutation of the numbers in i-th input line. The numbers should represent the vertices of a cube with ... | standard output | |
PASSED | 1993c3db4efa964cfe0b316341c18c5c | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class PoloThePenguinAndStrings {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 06a0c4558e2da935fa50f3e6154a6014 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] x=br.readLine().split(" ");
int n=In... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | bb2c369e8bed54f7fb74324573f2db3c | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
static StringBuilder sb = new StringBuilder();
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 249dc4b6734dd8208814faca020fc85e | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A{
static String solve(int n, int k) {
if (n < k) return "-1";
StringBuilder sb = new StringBuilder();
if (n == k)
for (int i=0; i<k; i++)
sb.append(((char)( ((int)'a') + i)));
else if (k == 1) // How ca... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 19cba851d037fa42d9019148f98c00a7 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author hadi0x7c7.blog.ir
*/
public... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 70334d8f1894873547efa8281fc37408 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.util.*;
public class A288 {
public static void main(String[] args){
Scanner br = new Scanner(System.in);
int n = br.nextInt();
int k = br.nextInt();
if(k > n || (k == 1 && n > 1)){
System.out.println(-1);
return;
}
if(n == 1 && k == 1){
System.out.println("a");
return;
}
StringB... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | d5df7a0f095ef17e224b52a5968fb360 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | //package contest;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class ProblemA {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
int[] read... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | c5cb3f607eb663e0a8147ebd282ca093 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import static java.lang.Math.*;
import java.io.*;
import java.util.*;
import java.math.*;
public class Template {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String next() {
while (st==null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine());
} catch (Exception e)... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 1334d93eb2bc2145b49a7ed998d7b526 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) throws IOException {
BufferedReader Bf = new BufferedReader(new InputStreamReader(System.in));
String input = Bf.readLine();
String out = "";
StringTokenizer str = new StringTokenizer(input, " ");
int i = 2;
i... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 80333a4cdc313284c08b96bc5719006b | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.util.Scanner;
public class A288 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int N = input.nextInt();
int K = input.nextInt();
if (N < K || (K == 1 && N != 1)) {
System.out.println("-1");
} else {
if ... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | ca67862bb512300d913d8a8249bca8d3 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Vaibhav Mittal
*/
public class Main {
public static void main(String[] args) {
Inp... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 3b74a466e266a9e8c0a8fa8013a0a574 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] s =br.readLine().sp... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | bbbc8ec7aad6ca0cc731b40154b1a238 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.*;
import java.util.*;
public final class penguin_and_strings
{
static Scanner sc=new Scanner(System.in);
static PrintWriter out=new PrintWriter(System.out);
static void solve(int n,int m)
{
char[] a=new char[26];
int j=0;
for(int i=97;i<=122;i++)
{
a[j]=(char)i;
j++;
}
StringBuff... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 9a1d22054d12779a9f7543aa2d8eab64 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
void solve() throws IOException {
int n = nextInt();
int k = nextInt();
if (n < k) {
out.println("-1");
return;
}
if (k == 1) {
out.println(n == 1 ? "a" : "-1");
retu... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 1f0f6264702abe1900e3131aef3b292f | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.util.*;
import java.io.*;
public class cf288A {
static InputReader in = new InputReader();
static String str;
static String[] arr;
public static void main(String[] args) throws Exception {
str = in.readLine();
int n = Integer.parseInt(str.substring(0, str.indexOf(" ")));
int k = Integer.parse... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 3a5c3878bedaf5ce0f361ea1d9e9e942 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class PoloThePenguinAndStrings {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 81d93fd00a0bc67dc1741a702af46099 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class PoloThePenguinAndStrings {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String [] in = br.readLine().spli... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 8e157faea7b78be16b7c99895b65ff06 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class PoloThePenguinAndStrings {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String [] in = br.readLine().spli... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | aa40467f4bf7301ba0d3c2aac65abd02 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class PoloThePenguinAndStrings {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 942ca80cde1e506ff1bb322dcf6239b5 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
static StringBuilder sb = new StringBuilder();
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 6ebe843576b38e66651cf00f3e0c018e | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.ListIterator;
import ... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | a8c43754cc46abef371e7388d772ef08 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes |
import java.io.InputStreamReader ;
import java.io.BufferedReader ;
import java.io.IOException;
public class prob10 {
public static void main(String[]args)throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String[] in=br.readLine().split(" ");
... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 6f35e33531e2c28045ccbad34f061f2b | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args)throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s=br.readLine()... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | f94158397dfbed30cebd10727b3fdbf7 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) throws Exception {
new A().solve();
// new FileInputStream(new File("input.txt")),
// new PrintStream(new FileOutputStream(new File("output.txt"))));
}
void solve() throws IOException {
... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 177b78fa4b442917b5f6de1f8a5ca2e7 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
/*
* @author Ivan Pryvalov (ivan.pryvalov@gmai... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 93505b1a062d544c870695150879e457 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import static java.lang.Math.*;
import java.io.*;
import java.util.*;
import java.math.*;
public class Template {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
String next() {
while (st==null || !st.hasMoreTokens()) {
try {
st = new StringTokenizer(in.readLine());
} catch (Exception e)... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | b123b7ea1c9ddd387121ee667ba511ff | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] s =br.readLine().split(" ");
int... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | c83c79ba0c81e261b14f2fce0c58a498 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | //package ru.akvasov.codeforces.r244;
import java.util.Scanner;
/**
* Created by akvasov on 15.05.14.
*/
public class A {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int k = scanner.nextInt();
StringBuilder sb =... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | c3202764605666096a0d9fb131ba7b53 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | /* Codeforces Template */
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;
public class Main {
static long initTime;
static final Random rnd = new Random(7777L);
static boo... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 0d3b6d9030a199b20f7a851656505787 | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
/**
* @param args
* @throws IOException
* @throws NumberFormatException
*/
public static void main(String[] args... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | 75b7ec812015fa24b37bc2aab479fcfa | train_001.jsonl | 1364916600 | Little penguin Polo adores strings. But most of all he adores strings of length n.One day he wanted to find a string that meets the following conditions: The string consists of n lowercase English letters (that is, the string's length equals n), exactly k of these letters are distinct. No two neighbouring letters of ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class CFR177A {
public static void findString(int n,int k) {
if (k > n || (k == 1 && n > 1)) {
System.out.println("-1");
return;
}
for (int i = 0; i < n - k + 2 && i < n ; i++) {
System.out.print(i % 2 == 0?"a":"b");
}
for (i... | Java | ["7 4", "4 7"] | 2 seconds | ["ababacd", "-1"] | null | Java 7 | standard input | [
"greedy"
] | 2f659be28674a81f58f5c587b6a0f465 | A single line contains two positive integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 26) — the string's length and the number of distinct letters. | 1,300 | In a single line print the required string. If there isn't such string, print "-1" (without the quotes). | standard output | |
PASSED | d560aa5bf3e2518bef8d8d7cd56a2935 | train_001.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public final class Watchmen {
public static long combinatoria(long n) {
return (n * (n - 1)) / 2;
}
static public ... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"math"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 9c0f85e03ae07d07e2c2d43556a82905 | train_001.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes |
import java.awt.Point;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Comparator;
public class A650 {
public static void main(String[] args) throws IOException {
InputReader reader = new InputReader(System.in);
int N = reader.readInt();
... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"math"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | bf31836d4dfd7e38f5a82516f9022b25 | train_001.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
public class A650 {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String[] inputs = bf.readLine().split(" ... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"math"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 8f1b56af9293ee268845c42df2498c23 | train_001.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.*;
import java.util.LinkedList;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class tmp {
public static void main(String [] args) throws Exception{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"math"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | d4f45acd7f40ee90a01ec57c9da9b8be | train_001.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Problems {
public static void main(String[] args) throws IOException {
new Problems().runMain();
}
void runMain() {
Scanner sc = new Scanner(System.in);
long counter = 0;
int n = sc.nextInt();
Map<Integer, Integer... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"math"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 6908a39b444fa32fce58ed651277a7bd | train_001.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
public class A {
static <T> void add(Map<T, Integer> S, T v) {
Integer num = S.get(v);
if(num == null) {
num = 0;
}
S.put(v, num + 1);
}
static <T>long calc(Map<T, Integer> S) {
... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"math"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | f5ccffbff4a86e2e789f8e4301b2f7c3 | train_001.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class A implements Runnable {
private static BufferedReader in;
private static PrintWriter out;
private static StringTokenizer st;
private static Random rnd;
private long getPair(long x, long y) {
return x * Integer.MAX_VALUE + y;
}
private vo... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"math"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 5d4e3ff7447770feebd5c1957f7448ce | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | /* https://codeforces.com/contest/378/problem/B
idea:
not care about whick k should be choosen in each semifinal.
first k element in each semifinals will be choose.
in each semifinals, in each element in k-th -> n will be choose
if it less than (n - k - 1) -th in the other simifinal.
*/
import j... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | e0b1307a5e16af1ed6928a4200809528 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.*;
public class Semifinals {
static void updateResult(ArrayList<Integer> ip1, ArrayList<Integer> ip2
, char[] result1, char[] result2)
{
int n = result1.length;
for (int i = n / 2; i < n; i++){
if (ip1.get(i) < ip2.get(n - i - 1)) {
resu... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 92568da2299719b7e8e1ccf53346755b | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a1 = new int[n];
int[] a2 = new int[n];
for(int i=0; i<n; i++){
a1[i] = sc.nextInt();
a2[i] = sc.nextInt();
... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | a01866965bc73d62025a492a0df7ebb1 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
public class Semifinals {
@SuppressWarnings("unchecked")
public static void main(String[] args) {
// TODO Auto-generate... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 80ff726c4de9ac65d205a4ad6f710f08 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes |
import java.util.PriorityQueue;
import java.util.Scanner;
public class SEMIFINALS {
public static void main(String[] args) {
Scanner nik = new Scanner(System.in);
PriorityQueue<pair> pq = new PriorityQueue<>();
int n = nik.nextInt();
StringBuilder st1 = new StringBuilder();
StringBuilder st2 = new Strin... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | a4a2461bfd9f72f9f3671f83f7f44217 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.*;
import java.io.*;
public final class Main {
static class Triplet {
int time;
int type;
int idx;
Triplet(int time, int type, int idx) {
this.time = time;
this.type = type;
this.idx = idx;
}
}
public static void ma... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 5c9ae5313ff391e84f0853e1df5d818f | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.Scanner;
public class Semifinals {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Integer numOfPlayer = input.nextInt();
Integer maxK = numOfPlayer/2;
StringBuilder chanceA = new StringBuilder();
StringBuilder chanceB = new ... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 6094a5b7941b2ae9946560fcb4775d88 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
public class C {
private static class P {
int i;
int s;
int sf;
publ... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 39a6af958c53bcc4c8c9c63d21f6e3e3 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class Semifinals {
void solve() {
int n = in.nextInt();
int[] a = new int[n], b = new int[n];
for (int ... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | ee5f351bcedca2e17e9c74d140a9f09c | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.ArrayList;
import java.io.InputStream;
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//input data
Scanner s = new Scanner(System.in);
int n = s.nextInt(); //number of participant each semifinal
... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 2eb3dba1200a9eb091f6fbde1a350018 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.ArrayList;
import java.io.InputStream;
import java.io.IOException;
import java.util.Scanner;
import java.lang.StringBuilder;
public class Main {
//idea: create a class that contains the participant's record and chance to enter
//We have 0 <= 2k <= n,... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 21453fedda8257a54338efb8fa1e0a13 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF378B {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] aa = new int[n];
int[] bb = new int[n];
for (int i = 0; i < n; i++)... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 5d08a31ae3e9d2022947297c2dca6ddf | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
ArrayList<Integer> s1 = new ArrayList<>();
ArrayList<Integer> s2 = new ArrayList<>();
HashSet<Integer> set = new HashSet<>();
ArrayLi... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 829de8b1d7f0e47ccc8bbdc1c15dd620 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
/**
*
* @author thachlp
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | f2c578088fd69cd3b4d0004dbb5f101e | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String []arg) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int [] a = new int [n];
int [] b = new int [n];
for(int i = 0 ; i < n; ++ ... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 5a9220a9ff25994f5a6d4c4b0f729435 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.*;
public class JavaApplication {
static int[] stuFirst = new int[100009];
static int[] stuSecond = new int[100009];
static int n;
public static void advancingStudent(ArrayList<Integer> first, ArrayList<Integer> second, int k) {
for (int i = 0; i < k; i++) {
stu... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 387d65b63325c217dc05ecaccb20becd | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int team1[] = new int [n + 7];
int team2[] = new int [n + 7];
for (int i = 1; i <= n; i++) {
team1[i] = in.nextInt();
team2[i] = in.nextInt();
}
... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | b25160fab9d4b74227d439e75c8aba85 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main extends PrintWriter {
BufferedReader in;
StringTokenizer stok;
final Random rand = new Random(31);
final int inf = (int) 1e9;
final long linf = (long) 1e18;
final static String IO = "_std";
class Item... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | cdfbeb8c3d2ee57f2145c09db71d98d5 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.Scanner;
import java.util.ArrayList;
public class B4 {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
int n = sc.nextInt();
ArrayList <Integer> a= new ArrayList<Integer>(),b = new ArrayList<Integer>();
for (int i=0;i<n;i++){
int x ,y ;
x = sc.nextI... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | 9522dd580a3849b1232fcf8c1abbaa02 | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.util.Scanner;
public class Problem4 {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int []a = new int [n];
int []b = new int [n];
int []resA = new int [n];
int []resB = new int [n];
for(int i = 0; i < n; ++i)
resA[i] = resB[i] ... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output | |
PASSED | e31202207872cd41875edecbce792b1b | train_001.jsonl | 1388331000 | Two semifinals have just been in the running tournament. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go to the peopl... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["4\n9840 9920\n9860 9980\n9930 10020\n10040 10090", "4\n9900 9850\n9940 9930\n10000 10020\n10060 10110"] | 1 second | ["1110\n1100", "1100\n1100"] | NoteConsider the first sample. Each semifinal has 4 participants. The results of the first semifinal are 9840, 9860, 9930, 10040. The results of the second semifinal are 9920, 9980, 10020, 10090. If k = 0, the finalists are determined by the time only, so players 9840, 9860, 9920 and 9930 advance to the finals. If k ... | Java 8 | standard input | [
"implementation",
"sortings"
] | bea30e4ba653b9d0af87fc79b9ec8b4f | The first line contains a single integer n (1 ≤ n ≤ 105) — the number of participants in each semifinal. Each of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 109) — the results of the i-th participant (the number of milliseconds he needs to cover the semifinals distance) of the first and second semifi... | 1,300 | Print two strings consisting of n characters, each equals either "0" or "1". The first line should correspond to the participants of the first semifinal, the second line should correspond to the participants of the second semifinal. The i-th character in the j-th line should equal "1" if the i-th participant of the j-t... | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.