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 | c9413429861818eef756a3d972c2159b | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Test1 {
public static void main(String[] args) {
FastScanner scanner = new FastScanner();
int n = scanner.nextInt();
int m = scanner.nextInt();
int k = sca... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | 054f0645c3058183e259c2dd28e645b9 | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.StringTokenizer;
public class C {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | c5ca8b4f1eb323e38bbecd46d1b903ff | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 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.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.math.Big... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | 840c7bd2d1261ae4d02893f328a9ba6d | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Map;
import java.io.BufferedReader;
import java.io.InputStream;
/**... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | bbac76c82fcf0c222119731a5b50a44b | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes | import java.util.*;
import java.io.*;
public class Ray_Tracing {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(f.readLine());
int n = Integer.parseInt(st.nextToken());
int m = Int... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | 18f2ae0cf6d4169f201baa6c76721caf | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
InputReader in=new InputReader(System.in);
PrintWriter out=new PrintWriter(System.out);
//Scanner in=new Scanner(System.in);
int n=in.nextInt();
int m=in.nex... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | ae9f227d9fe7709778581a4e31ba045a | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main {
FastScanner in;
PrintWriter out;
static final String FILE = "";
int n, m, k;
static long pack(int a, int b) {
return ((long)(a) << 32) + b;
}
static int getA(long v) {
return (int)... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | 1b0a8577f3b2495520f5f8589caba792 | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
public static void main(String[] args) ... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | 61e6fe381f7b963f86c4a7405aeee855 | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class ProblemC {
BufferedReader rd;
ProblemC() throws IOException {
rd = new BufferedReader(new InputStreamReader(System.in));
compute();
}
private void compute() th... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | cc4d8e13b981873379d2372722b7ef49 | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes | //package codeforces.intel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
public class RayTracing {
//http://codeforces.com/contest/724/problem/C
public void traceRay(int row,int col,int[][] data){
//two map to get the sum and dif of all data points
Has... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | ede648a6903f42a0705241c837fe141f | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.io.BufferedReader;
import java.util.regex.Pattern;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution i... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | 2d6ec3bdb304b043e39e06ae6df6c664 | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 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.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
static StringTokenizer st... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | 4c89d65de03ac94e3cc7cb1cbc441591 | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF724C {
static int gcd(int a, int b) {
return b == 0 ? a : gcd(b, a % b);
}
static int gcd_(int a, int b, int[] xy) {
if (b == 0) {
xy[0] = 1;
xy[1] = 0;
return a;
} else {
int d = gcd_(b, a % b, xy);
int t = xy[0] - a / b * xy[1];
xy[0] = ... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | 07a0d0a1405fb6c35961cf54e78a0c89 | train_002.jsonl | 1475928900 | There are k sensors located in the rectangular room of size nβΓβm meters. The i-th sensor is located at point (xi,βyi). All sensors are located at distinct points strictly inside the rectangle. Opposite corners of the room are located at points (0,β0) and (n,βm). Walls of the room are parallel to coordinate axes.At the... | 256 megabytes | import java.io.PrintWriter;
import java.util.*;
public class TaskC {
public static void main(String[] args) {
TaskC tC = new TaskC();
PrintWriter pw = new PrintWriter(System.out);
tC.solve(new Scanner(System.in), pw);
pw.close();
}
int n, m, k;
int max;
List<List<Integer>> list0;
List<List... | Java | ["3 3 4\n1 1\n1 2\n2 1\n2 2", "3 4 6\n1 1\n2 1\n1 2\n2 2\n1 3\n2 3", "7 4 5\n1 3\n2 2\n5 1\n5 3\n4 3"] | 2 seconds | ["1\n-1\n-1\n2", "1\n-1\n-1\n2\n5\n-1", "13\n2\n9\n5\n-1"] | NoteIn the first sample, the ray will consequently pass through the points (0,β0), (1,β1), (2,β2), (3,β3). Thus, it will stop at the point (3,β3) after 3 seconds. In the second sample, the ray will consequently pass through the following points: (0,β0), (1,β1), (2,β2), (3,β3), (2,β4), (1,β3), (0,β2), (1,β1), (2,β0), (... | Java 8 | standard input | [
"hashing",
"greedy",
"number theory",
"math",
"implementation",
"sortings"
] | 27a521d4d59066e50e870e7934d4b190 | The first line of the input contains three integers n, m and k (2ββ€βn,βmββ€β100β000, 1ββ€βkββ€β100β000)Β β lengths of the room's walls and the number of sensors. Each of the following k lines contains two integers xi and yi (1ββ€βxiββ€βnβ-β1, 1ββ€βyiββ€βmβ-β1)Β β coordinates of the sensors. It's guaranteed that no two sensors a... | 1,800 | Print k integers. The i-th of them should be equal to the number of seconds when the ray first passes through the point where the i-th sensor is located, or β-β1 if this will never happen. | standard output | |
PASSED | b0c271acdaa6ef64ebdcb1a6a09506bd | train_002.jsonl | 1298390400 | After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer!Some days before the contest, the teacher took a very simple-looking exam and all his n students took part in the exam. The teacher g... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Badr {
public static void main(String[] args) throws IOException{
BufferedReader buf =new BufferedReader(new InputStreamReader(System.in));
String s1=remove(buf.readLine()).toLowerCase();
... | Java | ["Iran_\nPersian;\nW_o;n;d;e;r;f;u;l;\n7\nWonderfulPersianIran\nwonderful_PersIAN_IRAN;;_\nWONDERFUL___IRAN__PERSIAN__;;\nIra__Persiann__Wonderful\nWonder;;fulPersian___;I;r;a;n;\n__________IranPersianWonderful__________\nPersianIran_is_Wonderful", "Shapur;;\nis___\na_genius\n3\nShapur__a_is___geniUs\nis___shapur___a__... | 2 seconds | ["ACC\nACC\nACC\nWA\nACC\nACC\nWA", "WA\nACC\nACC"] | null | Java 7 | standard input | [
"strings"
] | 95ccc87fe9e431f9c6eeffeaf049f797 | The first three lines contain a string each. These are the initial strings. They consists only of lowercase and uppercase Latin letters and signs ("-", ";" and "_"). All the initial strings have length from 1 to 100, inclusively. In the fourth line there is a single integer n (0ββ€βnββ€β1000), the number of students. Nex... | 1,300 | For each student write in a different line. Print "WA" if his answer is wrong or "ACC" if his answer is OK. | standard output | |
PASSED | 206d68eb15cdf233af8c4698085ddfad | train_002.jsonl | 1298390400 | After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer!Some days before the contest, the teacher took a very simple-looking exam and all his n students took part in the exam. The teacher g... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class HardWork {
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringBuilder out=new StringBuilder();
... | Java | ["Iran_\nPersian;\nW_o;n;d;e;r;f;u;l;\n7\nWonderfulPersianIran\nwonderful_PersIAN_IRAN;;_\nWONDERFUL___IRAN__PERSIAN__;;\nIra__Persiann__Wonderful\nWonder;;fulPersian___;I;r;a;n;\n__________IranPersianWonderful__________\nPersianIran_is_Wonderful", "Shapur;;\nis___\na_genius\n3\nShapur__a_is___geniUs\nis___shapur___a__... | 2 seconds | ["ACC\nACC\nACC\nWA\nACC\nACC\nWA", "WA\nACC\nACC"] | null | Java 7 | standard input | [
"strings"
] | 95ccc87fe9e431f9c6eeffeaf049f797 | The first three lines contain a string each. These are the initial strings. They consists only of lowercase and uppercase Latin letters and signs ("-", ";" and "_"). All the initial strings have length from 1 to 100, inclusively. In the fourth line there is a single integer n (0ββ€βnββ€β1000), the number of students. Nex... | 1,300 | For each student write in a different line. Print "WA" if his answer is wrong or "ACC" if his answer is OK. | standard output | |
PASSED | 3b817a252798469bb4103e0308abbdd9 | train_002.jsonl | 1298390400 | After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer!Some days before the contest, the teacher took a very simple-looking exam and all his n students took part in the exam. The teacher g... | 256 megabytes | import java.io.*;
import java.util.*;
public class HardWork
{
public static void main(String[] args) throws IOException
{
//Locale.setDefault (Locale.US);
Reader in = new Reader();
StringBuilder out = new StringBuilder();
String[] words;
String ans;
int n, c;
... | Java | ["Iran_\nPersian;\nW_o;n;d;e;r;f;u;l;\n7\nWonderfulPersianIran\nwonderful_PersIAN_IRAN;;_\nWONDERFUL___IRAN__PERSIAN__;;\nIra__Persiann__Wonderful\nWonder;;fulPersian___;I;r;a;n;\n__________IranPersianWonderful__________\nPersianIran_is_Wonderful", "Shapur;;\nis___\na_genius\n3\nShapur__a_is___geniUs\nis___shapur___a__... | 2 seconds | ["ACC\nACC\nACC\nWA\nACC\nACC\nWA", "WA\nACC\nACC"] | null | Java 7 | standard input | [
"strings"
] | 95ccc87fe9e431f9c6eeffeaf049f797 | The first three lines contain a string each. These are the initial strings. They consists only of lowercase and uppercase Latin letters and signs ("-", ";" and "_"). All the initial strings have length from 1 to 100, inclusively. In the fourth line there is a single integer n (0ββ€βnββ€β1000), the number of students. Nex... | 1,300 | For each student write in a different line. Print "WA" if his answer is wrong or "ACC" if his answer is OK. | standard output | |
PASSED | 94b13e9eef572ddf09a899100e769f58 | train_002.jsonl | 1298390400 | After the contest in comparing numbers, Shapur's teacher found out that he is a real genius and that no one could possibly do the calculations faster than him even using a super computer!Some days before the contest, the teacher took a very simple-looking exam and all his n students took part in the exam. The teacher g... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class hardWork {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader rdr = new BufferedReader (new InputStreamReader(System.in));
String one = rdr.read... | Java | ["Iran_\nPersian;\nW_o;n;d;e;r;f;u;l;\n7\nWonderfulPersianIran\nwonderful_PersIAN_IRAN;;_\nWONDERFUL___IRAN__PERSIAN__;;\nIra__Persiann__Wonderful\nWonder;;fulPersian___;I;r;a;n;\n__________IranPersianWonderful__________\nPersianIran_is_Wonderful", "Shapur;;\nis___\na_genius\n3\nShapur__a_is___geniUs\nis___shapur___a__... | 2 seconds | ["ACC\nACC\nACC\nWA\nACC\nACC\nWA", "WA\nACC\nACC"] | null | Java 7 | standard input | [
"strings"
] | 95ccc87fe9e431f9c6eeffeaf049f797 | The first three lines contain a string each. These are the initial strings. They consists only of lowercase and uppercase Latin letters and signs ("-", ";" and "_"). All the initial strings have length from 1 to 100, inclusively. In the fourth line there is a single integer n (0ββ€βnββ€β1000), the number of students. Nex... | 1,300 | For each student write in a different line. Print "WA" if his answer is wrong or "ACC" if his answer is OK. | standard output | |
PASSED | 55b568d89c8da3447be0970c92bc5439 | train_002.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;
public class Main implements Runnable {
private static ... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1βΓβ(1β/β2)β+β2βΓβ(1β/β2)β=β1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 6 | standard input | [
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1ββ€βnββ€β105) β the number of nodes in the tree. The next nβ-β1 lines contain the tree edges. The i-th line contains integers ai, bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) β the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number β the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | ac15327e831bf5fd82e418b205b9f59e | train_002.jsonl | 1362929400 | Momiji has got a rooted tree, consisting of n nodes. The tree nodes are numbered by integers from 1 to n. The root has number 1. Momiji decided to play a game on this tree.The game consists of several steps. On each step, Momiji chooses one of the remaining tree nodes (let's denote it by v) and removes all the subtree ... | 256 megabytes | import java.awt.geom.Rectangle2D;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class E
{
String line;
StringTokenizer inputParser;
BufferedReader is;
FileInputStream fstream;
DataInputStream in;
void openInput(String file)
{
if(file==null)is = new BufferedReader(new InputStream... | Java | ["2\n1 2", "3\n1 2\n1 3"] | 1 second | ["1.50000000000000000000", "2.00000000000000000000"] | NoteIn the first sample, there are two cases. One is directly remove the root and another is remove the root after one step. Thus the expected steps are: 1βΓβ(1β/β2)β+β2βΓβ(1β/β2)β=β1.5In the second sample, things get more complex. There are two cases that reduce to the first sample, and one case cleaned at once. Thus ... | Java 6 | standard input | [
"math"
] | 85b78251160db9d7ca1786e90e5d6f21 | The first line contains integer n (1ββ€βnββ€β105) β the number of nodes in the tree. The next nβ-β1 lines contain the tree edges. The i-th line contains integers ai, bi (1ββ€βai,βbiββ€βn;Β aiββ βbi) β the numbers of the nodes that are connected by the i-th edge. It is guaranteed that the given graph is a tree. | 2,200 | Print a single real number β the expectation of the number of steps in the described game. The answer will be considered correct if the absolute or relative error doesn't exceed 10β-β6. | standard output | |
PASSED | 239945144fd847455ffd0f199953b437 | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | import org.omg.CORBA.INTERNAL;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class C510 {
static List<Integer>L[];
static boolean visited[] = new boolean[33];
static int size[] = new int[33];
static List<Integer>ans = new ArrayL... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | 3eeb653adea89ebf57c2af4a7d0624cb | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | //package Solutions.Codeforces;
import java.util.*;
import java.io.*;
public class codeforces_510C_2 {
static boolean visited[];
static List<Integer>[] graph;
static boolean cycle[];
static PrintWriter out;
static ArrayList<Integer> res;
static void dfs(int u) {
visited[u] = cycle[u] ... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | e37dbdb9862d01b89e2efa2c1233c72c | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | import java.util.*;
public class solution{
static Map<Character,List<Character>> map=new HashMap<>();
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
Stack<Character> st=new Stack<>();
int n=sc.nextInt();
String[] temp=new String[n];
for(int i=0... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | 1bd9b45b0131c4bcff2d42075ad1d34c | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | import java.util.*;
public class solution{
static Map<Character,List<Character>> map=new HashMap<>();
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
Stack<Character> st=new Stack<>();
int n=sc.nextInt();
String[] temp=new String[n];
for(int i=0... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | bf3ea16ee0e01308ce34421b793e46e1 | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int test = Integer.parseInt(b... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | ced53852746c420e50cc8f2cc200d9ff | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | import java.util.*;
public class Za {
static Scanner sc = new Scanner(System.in);
static int n = sc.nextInt();
static int num = 0;
static int[] fix = new int[26];
static String[] arr = new String[n];
static int[] P = new int[26];
static ArrayList<ArrayList<Integer>> V = new ArrayList<ArrayList<Integer>>();
publ... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | 7814bd6e5a6ee2fd73cce87daf809425 | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | import java.util.*;
public class Za {
static Scanner sc = new Scanner(System.in);
static int n = sc.nextInt();
static int num = 0;
static int[] fix = new int[26];
static String[] arr = new String[n];
static int[] P = new int[26];
static ArrayList<ArrayList<Integer>> V = new ArrayList<ArrayList<Integer>>();
publ... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | a9a1d70cbafcfc9d04f84758bde22135 | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.ArrayList;
import java.util.Queue;
import java.util.LinkedList;
import java.util.Arrays;
public class Main
{
public static void main(String[] args... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | 8b51ba8d4621faa1b8893897c6c5d14c | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.ArrayList;
import java.util.Queue;
import java.util.LinkedList;
import java.util.HashSet;
public class Main
{
static ArrayList<ArrayList<Intege... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | 867ec6bee26fcbcfa65a6087c94075f1 | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | import java.io.*;
import java.util.*;
/*
3
rivest
shamir
adleman
*/
public class Foxname {
public static void main(String[] args) throws IOException {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
scan.nextLine();
String [] arr = new String[n];
int [] [] ... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | 807d71b1a33a6bcbb89120026656ced0 | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes |
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;
public class Main {
static void dfs(List<String> list,char start,int[] states){//1 = temp , 2 visited
if (states[start-'a']==1){
System.out.println("Impossible");
System.exit(0);
}el... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | 42783dd3aa03d9eeedde4261fb7bc561 | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 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.util.Collection;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.Writer... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | 26ecdca96245d3ce2f8e2560b48649f3 | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | import java.io.PrintWriter;
import java.util.*;
public class Main {
static Scanner in;
public static void main(String[] args) {
in = new Scanner(System.in);
int n = in.nextInt();
String[] names = new String[n];
for (int i = 0; i < n; i++) {
names[i] = in.next();
... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | 88f2bf5e444b7057f404ea71c57bffa4 | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.InputMismatchException;
import java.util.Lin... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | 418c6ce29e20a756804eeb2c0830ccfa | train_002.jsonl | 1422894600 | Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in lex... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.InputMismatchException;
import java.util.Lin... | Java | ["3\nrivest\nshamir\nadleman", "10\ntourist\npetr\nwjmzbmr\nyeputons\nvepifanov\nscottwu\noooooooooooooooo\nsubscriber\nrowdark\ntankengineer", "10\npetr\negor\nendagorion\nfeferivan\nilovetanyaromanova\nkostka\ndmitriyh\nmaratsnowbear\nbredorjaguarturnik\ncgyforever", "7\ncar\ncare\ncareful\ncarefully\nbecarefuldontfo... | 2 seconds | ["bcdefghijklmnopqrsatuvwxyz", "Impossible", "aghjlnopefikdmbcqrstuvwxyz", "acbdefhijklmnogpqrstuvwxyz"] | null | Java 8 | standard input | [
"sortings",
"graphs",
"dfs and similar"
] | 12218097cf5c826d83ab11e5b049999f | The first line contains an integer n (1ββ€βnββ€β100): number of names. Each of the following n lines contain one string namei (1ββ€β|namei|ββ€β100), the i-th name. Each name contains only lowercase Latin letters. All names are different. | 1,600 | If there exists such order of letters that the given names are sorted lexicographically, output any such order as a permutation of characters 'a'β'z' (i. e. first output the first letter of the modified alphabet, then the second, and so on). Otherwise output a single word "Impossible" (without quotes). | standard output | |
PASSED | 7b021dfb4e2c846c3890284c188e9cb5 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class training {
public static boolean is(int arr[]){
if(arr[5]!=0 || arr[7]!=0)
return false;
int count=0;
if ( arr[2] >= arr[4] && arr[1] == arr[4] + arr[6] && arr[2] + arr[3] == arr[4] + arr[6]){
for (i... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 8 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | ab27e958a792cd5d756c935a8c94cecb | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
public class A342_XeniaAndDivisors {
public static void main(String[] arg) {
FastReader sc = new FastReader();
int n = ... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 8 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | f9ef8f5bac5ea3592ca4ec7bfb13baa3 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] ... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 8 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 6d6a6a79fb90fddf53ff8f4f4f9f232d | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import ja... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 8 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | b56e43ccc02727acb17ae5e45283da45 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Scanner;
public class XeniaAndDivisors {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[8];
for (int i = 1; i <= n; i++) {
a[in.nextInt()]++;
}
// for (int i = 0; i < a.length; i++) { System.out.println(a[i] + " " ... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 8 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 5d94378b43826bfbb0cda2d6d2182b39 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | //package codeforcesQuestions;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class cdf199a
{
static void merge(int arr[], int l, int m, int r)
{
int n1 = m - l + 1;
int n2 = r - m;
int L[] = new int [n1];
int R[] = new int [n2];
... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 8 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 05188a6f6469db2e9f4cff3c5bf55440 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 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 {
FastScanner in;
PrintWriter out;
public void run(Main oMain) {
try {
in = new FastScanner(new InputStreamReader... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 06bebad705e74fd94583a0e963cbab90 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Scanner;
public class XeniaAndDivisors {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int g124 = 0, g126 = 0, g136 = 0;
int v[] = new int[8];
for(int i = 1; i <= 7; i++) {
v[i] = 0;
}
for(int i = 0; i < n; i++) {
int x = sc.n... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 00365fd949cf7ed728c5718cd8c6e87e | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args) throws IOException
{
//Locale.setDefault (Locale.US);
Reader in = new Reader();
StringBuilder out = new StringBuilder();
int n;
boolean flag;
int[] nums, t = new int[3... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 95f0c30f6cbf76889be202efaca4bec6 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | //A. Xenia and Divisors
//time limit per test2 seconds
//memory limit per test256 megabytes
//inputstandard input
//outputstandard output
//Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so t... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 9089917d1eb956e43bf98be297653ce1 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.*;
import java.io.*;
/*
* author:yanghui
*/
public class A {
class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream));
tokenizer = null;
}
public InputRe... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 08990f30104409a6a7d9269cb028af94 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
public class CF199A {
public static void main(final String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | bccd8377677e788efe278f8a2d6a23f0 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes |
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class XeniaAndDivisors {
public static void main(String... args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
List<Integer> input = new ArrayList<Integ... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 84ed1c9bde46917718486855c3f04242 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
public static void main(String args[]) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = t_int(br);
int[] e = new int[8];
int[] d = t_int_a(br, n);
... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | cd98809b2aea0f37262784b6b665e446 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution342A {
public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
MyScanner sc = new MyScanner();
int n = sc.nextInt();
int gruop = n / 3;
int[] numbers = new int[7];
boolean contain5or7 = false;
int one = 0;
for (int ... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | f239b2a001beb099fa6fa6b8db4a35c1 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
/*
br = new BufferedReader(new FileReader("input.txt"));
pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
br = new BufferedReader(new InputStreamReade... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 917d6d4bf26b5befec26d4b140b7b2f3 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.*;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
import static java.lang.Math.min;
import static java.lang.Math.max;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class Main implements R... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | f7628fc637bd08f03d6442b469779600 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
BufferedReader in;
StringTokenizer str = null;
PrintWriter out;
private String next() throws Exception{
if (str == null || !str.hasMoreElements())
str = new StringTokenizer(in.readLine());
return str.nextToken();
}
... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | d8edc9fee1f04c81afa5b57c0428398b | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Scanner;
public class A342 {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] f = new int[7];
for (int i = 0; i < n; i++)
f[in.nextInt() - 1]++;
StringBuilder out = new Stri... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 28c949f6d959776bb41d1bfb642d6300 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String arg[]) {
Scanner reader = new Scanner(System.in);
int n = reader.nextInt();
int a[] = new int[8];
for (int i = 0; i < 8; i++)
a[i] = 0;
for (int i = 0; i < n; i++)
a[reader.... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 90ecb1120fcaff5db4794e3bd8436720 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | b9fc8fe5e54697dc56bcef5a910e9f8e | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new St... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 3046be300098a5218345861792fa719d | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Scanner;
public class ce {
public static void main(String[] args) throws IOException {
new ce().run();
}
Str... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | 724279d7e3eb777db77030c9050388a8 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 256 megabytes | import java.util.*;
public class A342 {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int ones = 0;
int twos = 0;
int threes = 0;
int fours = 0;
int sixes = 0;
for (int i = 0; i < n; i++) {
... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | d32018b7564974ff886fda5966a082b0 | train_002.jsonl | 1378540800 | Xenia the mathematician has a sequence consisting of n (n is divisible by 3) positive integers, each of them is at most 7. She wants to split the sequence into groups of three so that for each group of three a,βb,βc the following conditions held: aβ<βbβ<βc; a divides b, b divides c. Naturally, Xenia wants each ... | 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 implements Runnable {
private static void solve() throws IOException {
int n = nextInt();
int[] a = new int[n];
boolean some = false;
for... | Java | ["6\n1 1 1 2 2 2", "6\n2 2 1 1 4 6"] | 1 second | ["-1", "1 2 4\n1 2 6"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | 513234db1bab98c2c2ed6c7030c1ac72 | The first line contains integer n (3ββ€βnββ€β99999) β the number of elements in the sequence. The next line contains n positive integers, each of them is at most 7. It is guaranteed that n is divisible by 3. | 1,200 | If the required partition exists, print groups of three. Print each group as values of the elements it contains. You should print values in increasing order. Separate the groups and integers in groups by whitespaces. If there are multiple solutions, you can print any of them. If there is no solution, print -1. | standard output | |
PASSED | a202fe89129076b3591d25c42ebf8e5a | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.io.IOException;
import java.util.StringTokenizer;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.ArrayList;
import java.util.Collections;
import java.util.TreeSet;
import java.util.*;
... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 5d3de22765edc7cdb1130cfc5d2545fa | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.Arrays;
public class Main {
private static StreamTokenizer inputReader = new StreamTokenizer(
new BufferedReader(new InputStreamReader(System.in)));
public static int nextInt() {
int a = -1;
tr... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 9a9288307539c5ede3600c26b4583657 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.*;
public class week1B {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int numInputs = Integer.valueOf(sc.nextLine());
String[] inputs = sc.nextLine().split(" ");
System.out.println(getTimeUnits(inputs, numInputs));
sc.close();
}
static long getTimeUnits... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 445d1a1b4f9132e57b9416ebe1cf445a | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes |
import javafx.util.Pair;
import java.io.PrintWriter;
import java.util.*;
public class Ed4B {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int t = in.nextInt();
in.nextLine();
ArrayList<Pair> ... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 544cf67ee7dbd402850cc3de809c17d4 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
public class Main
{
public static void main(String[] args) throws Exception
{
long startTime = System.nanoTime();
int n = in.nextInt();
int [] indexes = new int[n+10];
for(int i=1;i<=n;i++)
{
indexes[in.n... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | e566b8f3520458fc45332fb58abe83cb | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
public class Main
{
public static void main(String[] args) throws Exception
{
long startTime = System.nanoTime();
int n = in.nextInt();
HashMap<Integer,Integer> indexes = new HashMap<Integer,Integer>();
for(int i=1;i... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | af0f4c2ab1106f06564d0c52de92d5b9 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.*;
import java.awt.geom.*;
import java.io.*;
import java.math.*;
public class Main
{
public static void main(String[] args) throws Exception
{
long startTime = System.nanoTime();
int n = in.nextInt();
int [] indexes = new int[n+10];
for(int i=1;i<=n;i++)
{
indexes[in.n... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 1cc46ee5704d697ec1c91a03a24ad364 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes |
import java.util.HashMap;
import java.util.Scanner;
public class JavaApplication31 {
public static int counter = 0 ,n ;
public static void main(String[] args)
{
int x = 0;
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
HashMap<Integer , Integer > f = ... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | f129e616101f5f5c26155e40e8097d7e | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author T.C.D
*/
public class Main... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 4da9d5ee99c487dbea16f48f28ea6c68 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.*;
public class PetyaString {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
for(int i = 0; i < n; i++){
map.put(in.ne... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 1c2279ab7b6f4833adab329a90834a80 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
Map<Integer, Integer> list = new HashMap<Integer, Integer>();
for(int i =0;i<n;i++){
int k = in.next... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | b827333b129aa0214a98ef3ef556ba24 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.*;
/**
* Created by danielmckee on 4/30/16.
*/
public class HDDOutdatedTechnology {
Scanner in = new Scanner(System.in);
Map<Integer, Integer> numToPos = new HashMap<>();
//List<Integer> frags = new ArrayList<>();
private void solve() {
long answer = 0;
int n = in.n... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 6235c30aff83071993b3dd66093ac134 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.*;
public class P612B
{
public static void main(String[] args)
{
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
long sum = 0;
for (int i = 0; i < n; i++)
map.put(scan.nextInt(), i);
for (int i = 1; i < n; i++... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 392e93191ba64d31bc2cc4e7a9344bc4 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.Scanner;
public class problem_612B {
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
long distance = 0;
int current = 1, currentIndex = -1;
int[] sectors = new int[n];
int[] sectorIndexes = new int[n];
for(int i = 0; i ... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 67997ab83b87d92a412f17580872e063 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.Comparator;
import java.util.Scanner;
public class B {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
long n = in.nextInt();
int[] arr = new int[(int)n + 1];
// Hdd[] arr = new Hdd[(int)n];
long ans = 0;
for (int i = 1;... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 97b4419456577418f54526d388feb9dc | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
public class HDDisoutdatedtechnology {
public static void main(String[] args) throws IOException {
BufferedReader in = new Buf... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | ef768ce269cc0952da4304734df03e93 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Hdd {
public static void main(String[] args)
{
MySime sc=new MySime();
int n=sc.nextInt();
int frag[]=new int[n+1];
long t=0;
for(int i=1;i<=n;i++)
{
int f=sc.nextInt();
frag[f]=i;
}... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | e99d0197916b1a8c8d8ee5f5908f2aca | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes |
import java.beans.Visibility;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
i... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 3db40e756fd7e5fbcf1645f79e2b4e32 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
public class Main {
static Scanner sc = new Scanner(System.in);
s... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | bd4d57f14d5b144b80a2301c10168d42 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.Scanner;
public final class HDDIsOutDatedCF {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int arr[]=new int[n+1];
for(int i=1;i<=n;i++){
int index=sc.nextInt();
arr[index]=i;
}
... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 59d6860dc39dd66bb0ac87fed89b0d32 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.Scanner;
public class HDD {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
int[] a=new int[n];
for(int i=0;i<n;i++){
int x=scan.nextInt();
a[x-1]=i+1;
}
long sum=0,diff;
... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 6b76fa8cd09b4ed67b5af548d6d848af | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
/**
* Created by WiNDWAY on 4/30/16.
*/
public class Codeforces_Educational_round_4_HDDIsOutdatedTechnology {
public static void main(String[] args) {
FScanner input = new FScanner();
out = ne... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | d774eda18de0fc9773c9b8c1358c4886 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.*;
public class test {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int numberOfFragments = scanner.nextInt();
HashMap<Integer, Integer> fragments = new HashMap<Integer, Integer>();
for(int i=0;i<numberOfFragments;i++){
fra... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 0b5d17293a7a66a4e66e748ce20051ae | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.Scanner;
public class HardDisk{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int ind[] = new int[n];
int i = 0;
while(i<n){
ind[in.nextInt()-1]=i;
i++;
}
long... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | f517c3dd35c2752b8c18537c08b43911 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes |
import java.awt.Point;
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
static StringBuilder... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | f727e159729b6b1d449114d416d83e4f | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.HashMap;
import java.util.Scanner;
public class HDD {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int length = scanner.nextInt();
HashMap<Integer, Integer> mapping = new HashMap<>();
for (int i = 1; i <= length; i++){
mapping.put(scanner.nextInt(), i);... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 68a65eef5c0b79da185db96ce204a296 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.HashMap;
import java.util.Scanner;
public class HDD {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int length = scanner.nextInt();
HashMap<Integer, Integer> mapping = new HashMap<>();
for (int i = 1; i <= length; i++){
mapping.put(scanner.nextInt(), i);... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 84dd14cdf27d829d4481fabcf14b9422 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Likai
*/
public class Main {
public static void main(String[] args) ... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 3d75644acaa38c5c690dd916c1f26336 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
if (n == 1) {
System.out.println("0");
return;
}
Long[] arr = new Long[n];
... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 07184035d3ce81099aaef2c2f11b7dd5 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class B612 {
public static void main(String[] args) {
//3 1 2
//
Scanner s = new Scanner(System.in);
int n = s.nextInt(), index = -1;
int[] frag = new int[n], indices = new int[n];
for(int i = 0 ; i < n; i++) {
fr... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 43fbf1f0b6395d5f993e22b24c379098 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.Scanner;
public class HDD {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int[] input = new int[in.nextInt()];
for(int i = 0; i < input.length; i++){
input[i] = in.nextInt();
}
long retsum = HDDisOutdated(input);
... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 745017fbc6cf3ebe6d2ea52a5197d6d0 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | /*
* Code Author: Sanket Udgirkar.
* DA-IICT
*/
import java.util.*;
import java.io.*;
public class Tester
{
public static long mod=(long)1e9+7;
public static void main(String[] args)
{
InputReader s=new InputReader(System.in);
OutputStream outputStream = System.out;
//PrintWriter out=new Prin... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 63f32aacafca81670e4b282bed646bd2 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class codeforcesB
{
public static void main(String[]args)throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
String s = br.readLine();
while (s != null)
{
int n =... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | ef2a7630e8f2b93fd8ccdd42bb0cd5a6 | train_002.jsonl | 1451055600 | HDD hard drives group data by sectors. All files are split to fragments and each of them are written in some sector of hard drive. Note the fragments can be written in sectors in arbitrary order.One of the problems of HDD hard drives is the following: the magnetic head should move from one sector to another to read som... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class CodeForces {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Number[] parts = new Number[sc.nextInt()];
for (int i = 0; i < parts.length; i++) {
parts[i] = new Number(sc.nextInt(), i)... | Java | ["3\n3 1 2", "5\n1 3 5 4 2"] | 1 second | ["3", "10"] | NoteIn the second example the head moves in the following way: 1->2 means movement from the sector 1 to the sector 5, i.e. it takes 4 time units 2->3 means movement from the sector 5 to the sector 2, i.e. it takes 3 time units 3->4 means movement from the sector 2 to the sector 4, i.e. it takes 2 time units... | Java 8 | standard input | [
"implementation",
"math"
] | 54e2b6bea0dc6ee68366405945af50c6 | The first line contains a positive integer n (1ββ€βnββ€β2Β·105) β the number of fragments. The second line contains n different integers fi (1ββ€βfiββ€βn) β the number of the fragment written in the i-th sector. | 1,200 | Print the only integer β the number of time units needed to read the file. | standard output | |
PASSED | 0ef1025dd580d0b524569fd4fce30a44 | train_002.jsonl | 1359732600 | Emuskald considers himself a master of flow algorithms. Now he has completed his most ingenious program yet β it calculates the maximum flow in an undirected graph. The graph consists of n vertices and m edges. Vertices are numbered from 1 to n. Vertices 1 and n being the source and the sink respectively.However, his m... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.Queue;
import java.util.LinkedList;
import java.util.Collection;
import java.io.InputStream... | Java | ["3 3\n3 2 10\n1 2 10\n3 1 5", "4 5\n1 2 10\n1 3 10\n2 3 5\n4 2 15\n3 4 5"] | 2 seconds | ["1\n0\n1", "0\n0\n1\n1\n0"] | NoteIn the first test case, 10 flow units pass through path , and 5 flow units pass directly from source to sink: . | Java 7 | standard input | [
"sortings",
"dfs and similar"
] | f065e8c469a5a71a9ef602b6d8bfc9e2 | The first line of input contains two space-separated integers n and m (2ββ€βnββ€β2Β·105, nβ-β1ββ€βmββ€β2Β·105), the number of vertices and edges in the graph. The following m lines contain three space-separated integers ai, bi and ci (1ββ€βai,βbiββ€βn, aiββ βbi, 1ββ€βciββ€β104), which means that there is an undirected edge from a... | 2,100 | Output m lines, each containing one integer di, which should be 0 if the direction of the i-th edge is aiβββbi (the flow goes from vertex ai to vertex bi) and should be 1 otherwise. The edges are numbered from 1 to m in the order they are given in the input. If there are several solutions you can print any of them. | standard output | |
PASSED | b01f8347a005a3ced41a32dd145fd94e | train_002.jsonl | 1359732600 | Emuskald considers himself a master of flow algorithms. Now he has completed his most ingenious program yet β it calculates the maximum flow in an undirected graph. The graph consists of n vertices and m edges. Vertices are numbered from 1 to n. Vertices 1 and n being the source and the sink respectively.However, his m... | 256 megabytes | import java.io.IOException;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Queue;
import java.util.LinkedList;
import java.util.Collection;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution i... | Java | ["3 3\n3 2 10\n1 2 10\n3 1 5", "4 5\n1 2 10\n1 3 10\n2 3 5\n4 2 15\n3 4 5"] | 2 seconds | ["1\n0\n1", "0\n0\n1\n1\n0"] | NoteIn the first test case, 10 flow units pass through path , and 5 flow units pass directly from source to sink: . | Java 7 | standard input | [
"sortings",
"dfs and similar"
] | f065e8c469a5a71a9ef602b6d8bfc9e2 | The first line of input contains two space-separated integers n and m (2ββ€βnββ€β2Β·105, nβ-β1ββ€βmββ€β2Β·105), the number of vertices and edges in the graph. The following m lines contain three space-separated integers ai, bi and ci (1ββ€βai,βbiββ€βn, aiββ βbi, 1ββ€βciββ€β104), which means that there is an undirected edge from a... | 2,100 | Output m lines, each containing one integer di, which should be 0 if the direction of the i-th edge is aiβββbi (the flow goes from vertex ai to vertex bi) and should be 1 otherwise. The edges are numbered from 1 to m in the order they are given in the input. If there are several solutions you can print any of them. | standard output | |
PASSED | a35505748b2bdc32a5e18f14eb733b05 | train_002.jsonl | 1359732600 | Emuskald considers himself a master of flow algorithms. Now he has completed his most ingenious program yet β it calculates the maximum flow in an undirected graph. The graph consists of n vertices and m edges. Vertices are numbered from 1 to n. Vertices 1 and n being the source and the sink respectively.However, his m... | 256 megabytes | import java.util.*;
import java.io.*;
public class FancyFence {
static String s = "4 5\n" +
"1 2 10\n" +
"1 3 10\n" +
"2 3 5\n" +
"4 2 15\n" +
"3 4 5";
static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.i... | Java | ["3 3\n3 2 10\n1 2 10\n3 1 5", "4 5\n1 2 10\n1 3 10\n2 3 5\n4 2 15\n3 4 5"] | 2 seconds | ["1\n0\n1", "0\n0\n1\n1\n0"] | NoteIn the first test case, 10 flow units pass through path , and 5 flow units pass directly from source to sink: . | Java 7 | standard input | [
"sortings",
"dfs and similar"
] | f065e8c469a5a71a9ef602b6d8bfc9e2 | The first line of input contains two space-separated integers n and m (2ββ€βnββ€β2Β·105, nβ-β1ββ€βmββ€β2Β·105), the number of vertices and edges in the graph. The following m lines contain three space-separated integers ai, bi and ci (1ββ€βai,βbiββ€βn, aiββ βbi, 1ββ€βciββ€β104), which means that there is an undirected edge from a... | 2,100 | Output m lines, each containing one integer di, which should be 0 if the direction of the i-th edge is aiβββbi (the flow goes from vertex ai to vertex bi) and should be 1 otherwise. The edges are numbered from 1 to m in the order they are given in the input. If there are several solutions you can print any of them. | standard output | |
PASSED | cdabf1d110898022d5dd63c95f27de8d | train_002.jsonl | 1359732600 | Emuskald considers himself a master of flow algorithms. Now he has completed his most ingenious program yet β it calculates the maximum flow in an undirected graph. The graph consists of n vertices and m edges. Vertices are numbered from 1 to n. Vertices 1 and n being the source and the sink respectively.However, his m... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.TreeSet;
import java.lang.Integer;
import java.util.Stack;
public class flow_kp_java {
... | Java | ["3 3\n3 2 10\n1 2 10\n3 1 5", "4 5\n1 2 10\n1 3 10\n2 3 5\n4 2 15\n3 4 5"] | 2 seconds | ["1\n0\n1", "0\n0\n1\n1\n0"] | NoteIn the first test case, 10 flow units pass through path , and 5 flow units pass directly from source to sink: . | Java 7 | standard input | [
"sortings",
"dfs and similar"
] | f065e8c469a5a71a9ef602b6d8bfc9e2 | The first line of input contains two space-separated integers n and m (2ββ€βnββ€β2Β·105, nβ-β1ββ€βmββ€β2Β·105), the number of vertices and edges in the graph. The following m lines contain three space-separated integers ai, bi and ci (1ββ€βai,βbiββ€βn, aiββ βbi, 1ββ€βciββ€β104), which means that there is an undirected edge from a... | 2,100 | Output m lines, each containing one integer di, which should be 0 if the direction of the i-th edge is aiβββbi (the flow goes from vertex ai to vertex bi) and should be 1 otherwise. The edges are numbered from 1 to m in the order they are given in the input. If there are several solutions you can print any of them. | standard output | |
PASSED | b4a689271adb4598f6bd87d14ccf9f80 | train_002.jsonl | 1359732600 | Emuskald considers himself a master of flow algorithms. Now he has completed his most ingenious program yet β it calculates the maximum flow in an undirected graph. The graph consists of n vertices and m edges. Vertices are numbered from 1 to n. Vertices 1 and n being the source and the sink respectively.However, his m... | 256 megabytes | import java.io.IOException;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Queue;
import java.util.LinkedList;
import java.util.Collection;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution i... | Java | ["3 3\n3 2 10\n1 2 10\n3 1 5", "4 5\n1 2 10\n1 3 10\n2 3 5\n4 2 15\n3 4 5"] | 2 seconds | ["1\n0\n1", "0\n0\n1\n1\n0"] | NoteIn the first test case, 10 flow units pass through path , and 5 flow units pass directly from source to sink: . | Java 7 | standard input | [
"sortings",
"dfs and similar"
] | f065e8c469a5a71a9ef602b6d8bfc9e2 | The first line of input contains two space-separated integers n and m (2ββ€βnββ€β2Β·105, nβ-β1ββ€βmββ€β2Β·105), the number of vertices and edges in the graph. The following m lines contain three space-separated integers ai, bi and ci (1ββ€βai,βbiββ€βn, aiββ βbi, 1ββ€βciββ€β104), which means that there is an undirected edge from a... | 2,100 | Output m lines, each containing one integer di, which should be 0 if the direction of the i-th edge is aiβββbi (the flow goes from vertex ai to vertex bi) and should be 1 otherwise. The edges are numbered from 1 to m in the order they are given in the input. If there are several solutions you can print any of them. | standard output | |
PASSED | 5b3d1d8310900ec66ea8ec6ea3b4027c | train_002.jsonl | 1366385400 | There is a straight snowy road, divided into n blocks. The blocks are numbered from 1 to n from left to right. If one moves from the i-th block to the (iβ+β1)-th block, he will leave a right footprint on the i-th block. Similarly, if one moves from the i-th block to the (iβ-β1)-th block, he will leave a left footprint ... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
int s = 0;
int t = 0;
int r = 0;
int l = 0;
String line = cin.next();
char[] path = line.toCharArray();... | Java | ["9\n..RRLL...", "11\n.RRRLLLLL.."] | 1 second | ["3 4", "7 5"] | NoteThe first test sample is the one in the picture. | Java 7 | standard input | [
"implementation",
"greedy"
] | 3053cba2426ebd113fcd70a9b026dad0 | The first line of the input contains integer n (3ββ€βnββ€β1000). The second line contains the description of the road β the string that consists of n characters. Each character will be either "." (a block without footprint), or "L" (a block with a left footprint), "R" (a block with a right footprint). It's guaranteed tha... | 1,300 | Print two space-separated integers β the values of s and t. If there are several possible solutions you can print any of them. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.