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 | 95d1b07b8dd37cf6a395e39ae9b5b46d | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
public class B265 {
static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
static PrintWriter out = new PrintWriter(System.out);
... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | d660a66649849a9d4ea098b137cb6155 | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.*;
import java.lang.reflect.Field;
import java.math.BigInteger;
import java.util.*;
public class codeforces implements Runnable {
private BufferedReader br = null;
private PrintWriter pw = null;
private StringTokenizer stk = new StringTokenizer("");
public static void main(String[] arg... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | bc55941fa79956f97d107a07d94a1f2f | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.StringTokenizer;
public class SolutionB {
BufferedReader in;
StringTokenizer str;
PrintWriter out;
String SK;
String next() throws IOException {
while ((str == null) || (!str.hasMoreTokens())) {
SK = in.readLine();
if (SK == null)
return nu... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 10b98c0d141c6cb651d8e0635c624ff7 | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.util.Scanner;
import java.math.*;
public class RoadSideTrees {
/**
* @param args
*/
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int n=input.nextInt();
int previoush=input.nextInt();
int t=previoush+1;
int h;
... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 520ed194adf1f74612b9168994fe715b | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.*;
import java.util.*;
public class RoadsideTreesSimp {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(f.readLine());
int prev = 0;
int count = 2*n-1;
... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | f58718fba69e95beef9043e3e7e98edd | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args)throws IOException
{
new Main().start();
}
public void start()throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
//int test=Integer.parseInt(br.readL... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | d38f79eb9e3f11e6c7614fa43110c63c | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.util.*;
import java.io.*;
public class R162B {
Scanner in;
PrintWriter out;
int n;
int a;
public void solve() throws IOException {
n = in.nextInt();
int cur = in.nextInt();
a = cur + 1;
for (int i = 2; i <= n; i++){
int next... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 4dcd81dbb75f7021f3d6808c0998f05e | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.*;
public class trees
{
public static void main(String[] a) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));
int n = Integer.parseInt(reader.readLi... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | db86047e8210e75147420bec48d90f7f | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 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.Collections;
import java.util.StringTokenizer;
/**
*
* @author Artem_Mikhalevitch
*/
public class Solver extends ASolver {
private int n;
pri... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | d2a97a0a3476f5e5e69ae1ae4ff6302d | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class A {
public static int[][] dp;
public static void main(String[] args) throws FileNotFoundException {
... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 44c280747214eee8136e5e839f7d5adc | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.util.Scanner;
public class RoadsideTrees
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int result = 0;
int temp = input.nextInt();
result += temp + 1;
int preH = temp;
for (int i = 1; i < n; ++i)
{
temp = input.nextInt();
... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | c61cbb1ff85e520d2f10ddbd6727b55e | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.util.*;
public class B265 {
public static void main(String[] args){
Scanner br = new Scanner(System.in);
int n = br.nextInt();
int pos = 0;
int ans = 0;
for(int i = 0;i<n;i++){
int cur = br.nextInt();
if(i != 0){
ans++;
... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | d5a1ffdceb5ebabc05a049e6d55b580e | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author lgsmitty
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream ... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 14d2dd8d08e0b97d3d27879539ff3447 | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.util.Scanner;
public class RoadsideTreesSimple {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int[] treeH=new int[n];
for (int i = 0; i < n; i++) {
treeH[i]=sc.nextInt();
}
int secondCnt=0;
int nowHeight=0;
for (int i = 0; i < n; i++) {
... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 015d517890b8f20fbb1b9d3ae62ee56f | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author lwc626
*/
public class Main {
pu... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 870611482ad216816f1e8ddd83f235ab | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Properties;
... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 89ddf3c67cca9c15d7949cb5665f5da9 | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
public class Main {
static class node implements Comparable<node> {
int i;
... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | cb428a4885d2d52fcacc53d68e51ced8 | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
public class Sorter {
int max;
int[] height;
public Sorter() {}
long process(){
long sum = 0,cu... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 3c4ce16bd963c8f1e5101199ecd16b24 | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//package codeforces160;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
*
* @author xeyyam
*/
public cl... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | d929767753c300b81ae3d10ba2a37d62 | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.*;
import java.util.*;
public class second
{
public static void main(String arr[])
{
Scanner sc= new Scanner(System.in);
int n = sc.nextInt();
int count=0;
int last=0;
for(int i=0;i<n;i++)
{
int new1 = sc.nextInt();
count+=Math.abs(new1-last)+1;
last=new1;
}
count+=n;
Syst... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | c03d9894d542a0d16a7f02a282e52e4f | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.util.Scanner;
public class oldpeykan {
public static void main(String args[])
{
Scanner input =new Scanner(System.in);
int n=input.nextInt();
int [] th=new int [n+1];
for(int i=1;i<n+1;i++)
th[i]=input.nextInt();
int sec=0;
/*sec+=th[0]+1;
if(th[0]<th[1])
{
sec+=2+th[1]-th[0];
}
... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 5055832f902f35ec93c1b74f9ab099c7 | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
public class CodeforcesR162Div2B {
public static int[] parseNumbers(String line, int n) {
int[] numbers = new int[n];
int idx = 0;
for(int i = 0; i < line.leng... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 7be9fb9cb51b28767d445c7a77fa7d6a | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.util.*;
public class cf265B{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n= sc.nextInt();
int prev =0;
long time =0;
int a = sc.nextInt();
time += a+1;
prev = a;
for(int i=1; i<n; i++)
{
int h = sc.nextInt();
time += Math.abs(p... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | ccd92ad605daf3dbd4332a4e16b00c48 | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import static java.lang.Math.*;
public class Main implements Runnable{
BufferedReader in;
PrintWriter out;
StringTokenizer tok;
void solve... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 8c01704a2e5601e5cb4904f8318eab8e | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.awt.Point;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Compar... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 3d796322f16fbb08462d2714b6bffede | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.Math.*;
public class Cf162B
{
public static void main(String args[])throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(br.readLine());
int val;
int i,j,k,l;... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | a21fd0afc867741de7d696ec538f531b | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int[] a = new int[n];
for(int i=0;i<n;i++) a[i]= s.nextInt();
int r = a[0] + 1;
for(int i=1;i<a.length;i++){
if(a[i] > a[i-1]){
r += a[i] - a[i-1] +... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 2529f81e6b5724237e6e7db4135e9688 | train_002.jsonl | 1358686800 | Squirrel Liss loves nuts. There are n trees (numbered 1 to n from west to east) along a street and there is a delicious nut on the top of each tree. The height of the tree i is hi. Liss wants to eat all nuts.Now Liss is on the root of the tree with the number 1. In one second Liss can perform one of the following actio... | 256 megabytes | import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int H[] = new int[n];
for(int i = 0;i<n;i... | Java | ["2\n1\n2", "5\n2\n1\n2\n1\n1"] | 2 seconds | ["5", "14"] | null | Java 6 | standard input | [
"implementation",
"greedy"
] | a20ca4b053ba71f6b2dc05749287e0a4 | The first line contains an integer n (1 ≤ n ≤ 105) — the number of trees. Next n lines contains the height of trees: i-th line contains an integer hi (1 ≤ hi ≤ 104) — the height of the tree with the number i. | 1,000 | Print a single integer — the minimal time required to eat all nuts in seconds. | standard output | |
PASSED | 241dc320a1a02817a794294a92149618 | train_002.jsonl | 1346427000 | The Little Elephant has two permutations a and b of length n, consisting of numbers from 1 to n, inclusive. Let's denote the i-th (1 ≤ i ≤ n) element of the permutation a as ai, the j-th (1 ≤ j ≤ n) element of the permutation b — as bj.The distance between permutations a and b is the minimum absolute value of the diffe... | 256 megabytes |
import java.math.*;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
PrintWriter out = new PrintWriter(System.out);
FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
Task solver = ... | Java | ["2\n1 2\n2 1", "4\n2 1 3 4\n3 4 2 1"] | 2 seconds | ["1\n0", "2\n1\n0\n1"] | null | Java 7 | standard input | [] | 4b1326b0891571ef8ccb63a3351d1851 | The first line contains a single integer n (1 ≤ n ≤ 105) — the size of the permutations. The second line contains permutation a as n distinct numbers from 1 to n, inclusive. The numbers are separated with single spaces. The third line contains permutation b in the same format. | 2,100 | In n lines print n integers — the answers for cyclic shifts. Print the answers to the shifts in the order of the shifts' numeration in permutation b, that is, first for the 1-st cyclic shift, then for the 2-nd, and so on. | standard output | |
PASSED | 7ac8c122e80ced0bbb0c70ad5e643911 | train_002.jsonl | 1346427000 | The Little Elephant has two permutations a and b of length n, consisting of numbers from 1 to n, inclusive. Let's denote the i-th (1 ≤ i ≤ n) element of the permutation a as ai, the j-th (1 ≤ j ≤ n) element of the permutation b — as bj.The distance between permutations a and b is the minimum absolute value of the diffe... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.PriorityQueue;
import java.util.AbstractQueue;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.u... | Java | ["2\n1 2\n2 1", "4\n2 1 3 4\n3 4 2 1"] | 2 seconds | ["1\n0", "2\n1\n0\n1"] | null | Java 7 | standard input | [] | 4b1326b0891571ef8ccb63a3351d1851 | The first line contains a single integer n (1 ≤ n ≤ 105) — the size of the permutations. The second line contains permutation a as n distinct numbers from 1 to n, inclusive. The numbers are separated with single spaces. The third line contains permutation b in the same format. | 2,100 | In n lines print n integers — the answers for cyclic shifts. Print the answers to the shifts in the order of the shifts' numeration in permutation b, that is, first for the 1-st cyclic shift, then for the 2-nd, and so on. | standard output | |
PASSED | 3d5d9da9b1ef95aafc38f9cd653ddcf3 | train_002.jsonl | 1346427000 | The Little Elephant has two permutations a and b of length n, consisting of numbers from 1 to n, inclusive. Let's denote the i-th (1 ≤ i ≤ n) element of the permutation a as ai, the j-th (1 ≤ j ≤ n) element of the permutation b — as bj.The distance between permutations a and b is the minimum absolute value of the diffe... | 256 megabytes | import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author George Marcus
*/
public class Main {
public static void main(String[] arg... | Java | ["2\n1 2\n2 1", "4\n2 1 3 4\n3 4 2 1"] | 2 seconds | ["1\n0", "2\n1\n0\n1"] | null | Java 7 | standard input | [] | 4b1326b0891571ef8ccb63a3351d1851 | The first line contains a single integer n (1 ≤ n ≤ 105) — the size of the permutations. The second line contains permutation a as n distinct numbers from 1 to n, inclusive. The numbers are separated with single spaces. The third line contains permutation b in the same format. | 2,100 | In n lines print n integers — the answers for cyclic shifts. Print the answers to the shifts in the order of the shifts' numeration in permutation b, that is, first for the 1-st cyclic shift, then for the 2-nd, and so on. | standard output | |
PASSED | 997ca1f0423c722c082e439423f90167 | train_002.jsonl | 1346427000 | The Little Elephant has two permutations a and b of length n, consisting of numbers from 1 to n, inclusive. Let's denote the i-th (1 ≤ i ≤ n) element of the permutation a as ai, the j-th (1 ≤ j ≤ n) element of the permutation b — as bj.The distance between permutations a and b is the minimum absolute value of the diffe... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.PriorityQueue;
import java.util.AbstractQueue;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.u... | Java | ["2\n1 2\n2 1", "4\n2 1 3 4\n3 4 2 1"] | 2 seconds | ["1\n0", "2\n1\n0\n1"] | null | Java 7 | standard input | [] | 4b1326b0891571ef8ccb63a3351d1851 | The first line contains a single integer n (1 ≤ n ≤ 105) — the size of the permutations. The second line contains permutation a as n distinct numbers from 1 to n, inclusive. The numbers are separated with single spaces. The third line contains permutation b in the same format. | 2,100 | In n lines print n integers — the answers for cyclic shifts. Print the answers to the shifts in the order of the shifts' numeration in permutation b, that is, first for the 1-st cyclic shift, then for the 2-nd, and so on. | standard output | |
PASSED | 554df76a28b8246caca490eb261bd3b2 | train_002.jsonl | 1336663800 | Zart PMP is qualified for ICPC World Finals in Harbin, China. After team excursion to Sun Island Park for snow sculpture art exposition, PMP should get back to buses before they leave. But the park is really big and he does not know how to find them.The park has n intersections numbered 1 through n. There are m bidirec... | 256 megabytes | // practice with rainboy
import java.io.*;
import java.util.*;
public class CF187C extends PrintWriter {
CF187C() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF187C o = new CF187C(); o.main(); o.flush();
}
int[] dsu;
int find(int i) {
return dsu[i]... | Java | ["6 6 3\n1 3 6\n1 2\n2 3\n4 2\n5 6\n4 5\n3 4\n1 6", "6 5 3\n1 5 6\n1 2\n2 3\n3 4\n4 5\n6 3\n1 5"] | 2 seconds | ["3", "3"] | NoteThe first sample is illustrated below. Blue intersections are where volunteers are located. If PMP goes in the path of dashed line, it can reach the buses with q = 3: In the second sample, PMP uses intersection 6 as an intermediate intersection, thus the answer is 3. | Java 8 | standard input | [
"dsu",
"dfs and similar"
] | 1b336422bb45642d01cc098d953884a6 | The first line contains three space-separated integers n, m, k (2 ≤ n ≤ 105, 0 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of intersections, roads and volunteers, respectively. Next line contains k distinct space-separated integers between 1 and n inclusive — the numbers of cities where volunteers are located. Next m lines de... | 2,000 | Print on the only line the answer to the problem — the minimum value of q which guarantees that PMP can find the buses. If PMP cannot reach the buses at all, output -1 instead. | standard output | |
PASSED | 9ab813c91c1062ea8cfa50a4e56e414f | train_002.jsonl | 1336663800 | Zart PMP is qualified for ICPC World Finals in Harbin, China. After team excursion to Sun Island Park for snow sculpture art exposition, PMP should get back to buses before they leave. But the park is really big and he does not know how to find them.The park has n intersections numbered 1 through n. There are m bidirec... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitS... | Java | ["6 6 3\n1 3 6\n1 2\n2 3\n4 2\n5 6\n4 5\n3 4\n1 6", "6 5 3\n1 5 6\n1 2\n2 3\n3 4\n4 5\n6 3\n1 5"] | 2 seconds | ["3", "3"] | NoteThe first sample is illustrated below. Blue intersections are where volunteers are located. If PMP goes in the path of dashed line, it can reach the buses with q = 3: In the second sample, PMP uses intersection 6 as an intermediate intersection, thus the answer is 3. | Java 8 | standard input | [
"dsu",
"dfs and similar"
] | 1b336422bb45642d01cc098d953884a6 | The first line contains three space-separated integers n, m, k (2 ≤ n ≤ 105, 0 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of intersections, roads and volunteers, respectively. Next line contains k distinct space-separated integers between 1 and n inclusive — the numbers of cities where volunteers are located. Next m lines de... | 2,000 | Print on the only line the answer to the problem — the minimum value of q which guarantees that PMP can find the buses. If PMP cannot reach the buses at all, output -1 instead. | standard output | |
PASSED | f82f35cb9dd558a0bff1ba36b9bc8a5c | train_002.jsonl | 1336663800 | Zart PMP is qualified for ICPC World Finals in Harbin, China. After team excursion to Sun Island Park for snow sculpture art exposition, PMP should get back to buses before they leave. But the park is really big and he does not know how to find them.The park has n intersections numbered 1 through n. There are m bidirec... | 256 megabytes | import java.io.*;
import java.util.*;
public class C implements Runnable {
public static void main (String[] args) {new Thread(null, new C(), "_cf", 1 << 28).start();}
public void run() {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
System.err.println("");
int n = fs.n... | Java | ["6 6 3\n1 3 6\n1 2\n2 3\n4 2\n5 6\n4 5\n3 4\n1 6", "6 5 3\n1 5 6\n1 2\n2 3\n3 4\n4 5\n6 3\n1 5"] | 2 seconds | ["3", "3"] | NoteThe first sample is illustrated below. Blue intersections are where volunteers are located. If PMP goes in the path of dashed line, it can reach the buses with q = 3: In the second sample, PMP uses intersection 6 as an intermediate intersection, thus the answer is 3. | Java 8 | standard input | [
"dsu",
"dfs and similar"
] | 1b336422bb45642d01cc098d953884a6 | The first line contains three space-separated integers n, m, k (2 ≤ n ≤ 105, 0 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of intersections, roads and volunteers, respectively. Next line contains k distinct space-separated integers between 1 and n inclusive — the numbers of cities where volunteers are located. Next m lines de... | 2,000 | Print on the only line the answer to the problem — the minimum value of q which guarantees that PMP can find the buses. If PMP cannot reach the buses at all, output -1 instead. | standard output | |
PASSED | d00834e2470f36ebcd7d454914f7c4e4 | train_002.jsonl | 1336663800 | Zart PMP is qualified for ICPC World Finals in Harbin, China. After team excursion to Sun Island Park for snow sculpture art exposition, PMP should get back to buses before they leave. But the park is really big and he does not know how to find them.The park has n intersections numbered 1 through n. There are m bidirec... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.io.OutputStream;
import java.util.ArrayDeque;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Queue;
import java.util.Collect... | Java | ["6 6 3\n1 3 6\n1 2\n2 3\n4 2\n5 6\n4 5\n3 4\n1 6", "6 5 3\n1 5 6\n1 2\n2 3\n3 4\n4 5\n6 3\n1 5"] | 2 seconds | ["3", "3"] | NoteThe first sample is illustrated below. Blue intersections are where volunteers are located. If PMP goes in the path of dashed line, it can reach the buses with q = 3: In the second sample, PMP uses intersection 6 as an intermediate intersection, thus the answer is 3. | Java 6 | standard input | [
"dsu",
"dfs and similar"
] | 1b336422bb45642d01cc098d953884a6 | The first line contains three space-separated integers n, m, k (2 ≤ n ≤ 105, 0 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of intersections, roads and volunteers, respectively. Next line contains k distinct space-separated integers between 1 and n inclusive — the numbers of cities where volunteers are located. Next m lines de... | 2,000 | Print on the only line the answer to the problem — the minimum value of q which guarantees that PMP can find the buses. If PMP cannot reach the buses at all, output -1 instead. | standard output | |
PASSED | 8d7fcaaa428618210ff470a6eaa72e75 | train_002.jsonl | 1336663800 | Zart PMP is qualified for ICPC World Finals in Harbin, China. After team excursion to Sun Island Park for snow sculpture art exposition, PMP should get back to buses before they leave. But the park is really big and he does not know how to find them.The park has n intersections numbered 1 through n. There are m bidirec... | 256 megabytes | import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;
/**
* @author Roman Elizarov
*/
public class Round_119_C {
public static void main(String[] args) {
new Round_119_C().go();
}
int n;
int m;
int k;
boolean[] good;
int[][] e;
int[] ec;
int s;
int t;
void go() {
// read in... | Java | ["6 6 3\n1 3 6\n1 2\n2 3\n4 2\n5 6\n4 5\n3 4\n1 6", "6 5 3\n1 5 6\n1 2\n2 3\n3 4\n4 5\n6 3\n1 5"] | 2 seconds | ["3", "3"] | NoteThe first sample is illustrated below. Blue intersections are where volunteers are located. If PMP goes in the path of dashed line, it can reach the buses with q = 3: In the second sample, PMP uses intersection 6 as an intermediate intersection, thus the answer is 3. | Java 6 | standard input | [
"dsu",
"dfs and similar"
] | 1b336422bb45642d01cc098d953884a6 | The first line contains three space-separated integers n, m, k (2 ≤ n ≤ 105, 0 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of intersections, roads and volunteers, respectively. Next line contains k distinct space-separated integers between 1 and n inclusive — the numbers of cities where volunteers are located. Next m lines de... | 2,000 | Print on the only line the answer to the problem — the minimum value of q which guarantees that PMP can find the buses. If PMP cannot reach the buses at all, output -1 instead. | standard output | |
PASSED | 67eb19731f671872bd298bdd2d21bdf5 | train_002.jsonl | 1336663800 | Zart PMP is qualified for ICPC World Finals in Harbin, China. After team excursion to Sun Island Park for snow sculpture art exposition, PMP should get back to buses before they leave. But the park is really big and he does not know how to find them.The park has n intersections numbered 1 through n. There are m bidirec... | 256 megabytes |
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.*;
import java.util.concurrent.PriorityBlockingQueue;
public class Solution{
int n;
boolean[]have;
Integer[][]g;
int s,t;
void solve()throws Exception
{
n=nextInt();
int m=n... | Java | ["6 6 3\n1 3 6\n1 2\n2 3\n4 2\n5 6\n4 5\n3 4\n1 6", "6 5 3\n1 5 6\n1 2\n2 3\n3 4\n4 5\n6 3\n1 5"] | 2 seconds | ["3", "3"] | NoteThe first sample is illustrated below. Blue intersections are where volunteers are located. If PMP goes in the path of dashed line, it can reach the buses with q = 3: In the second sample, PMP uses intersection 6 as an intermediate intersection, thus the answer is 3. | Java 6 | standard input | [
"dsu",
"dfs and similar"
] | 1b336422bb45642d01cc098d953884a6 | The first line contains three space-separated integers n, m, k (2 ≤ n ≤ 105, 0 ≤ m ≤ 2·105, 1 ≤ k ≤ n) — the number of intersections, roads and volunteers, respectively. Next line contains k distinct space-separated integers between 1 and n inclusive — the numbers of cities where volunteers are located. Next m lines de... | 2,000 | Print on the only line the answer to the problem — the minimum value of q which guarantees that PMP can find the buses. If PMP cannot reach the buses at all, output -1 instead. | standard output | |
PASSED | 52fa918b5a10cd08ba0d1223d29fabc8 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes |
import java.util.*;
public class Codeforces1320A {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[n];
for(int i =0 ; i < n ; i++)a[i] = sc.nextInt();
Map<Integer , Long> map = new HashMap<>();
... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | 4d089befa34937c09d4b83ced10a1ce2 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.StringTokenizer;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.File;
import java.lang.*;
import java.net.*;
public class Main
{
static class ... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | 614b5c8502ff70ff1a0d24210736dffd | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.io.*;
import java.util.*;
public class cf1320_Div2_A {
public static void main(String[] args) throws IOException {
FastScanner in = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
long[] pre = new long[(int)(2 * 5e5 + 2)];... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | 7b1125290fa137f9d517cde93d9bb091 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.io.*;
import java.util.*;
/*
Прокрастинирую
*/
public class Main {
static FastReader in;
static PrintWriter out;
static Random rand = new Random();
static final int INF = (int) (1e9 + 10);
static final int MOD = (int) (1e9 + 7);
static final int N = (int) (1e6);
static final i... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | 8722ea452a61254a9a2920724f0fc853 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.math.*;
public class A1320 {
public static void main(String[] args) throws IOException {
PrintWriter out = new PrintWriter(System.out);
Reader s = new Reader();
int n = s.i();
long [] arr = s.arrLong(n);
HashMap<Long,Long> m... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | 6883a3d7465bff9fc43f9c5ccb237182 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
import java.util.stream.*;
@SuppressWarnings("unchecked")
public class A_Journey_Planning {
public static PrintWriter out;
public static InputReader in;
public static long MOD = (long)1e9+7;
pub... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | cb2081bd07260c176fb34fb6f8416621 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | // practice with kaiboy
import java.io.*;
import java.util.*;
public class CF1320A extends PrintWriter {
CF1320A() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1320A o = new CF1320A(); o.main(); o.flush();
}
void main() {
int n = sc.nextInt();
in... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | 2fdcbef7158152a6f5ce5fc2a6eaf710 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.io.*;
import java.util.*;
public class Journey_Planning {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st =... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | d326477199d701ca56a3f2e0189ae051 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | /*input
6
10 7 1 9 10 15
*/
import java.math.*;
import java.io.*;
import java.util.*;
public class Main
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reade... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | b65929e0610272b2fdf3f96765834e96 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner();
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
int[] a = new int[n];
long[] dp = new long[n];
long ans = 0;
TreeMap<Integer, Integer> firs... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | b7658ae24c2705224ea3bfa706239344 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.util.*;
import java.io.*;
public class HelloWorld{
public static void main(String []args)throws IOException{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(reader.readLine()), arr[] = new int[n];
... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | 4bd5df0b345adbd9511c4ba71da4b5b9 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.io.*;
import java.util.*;
public class main{
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
int n =sc.nextInt();
long[] arr = new long[n];
for(int i=0;i<n;i++){
arr[i]=sc.nextLong();
}
H... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | c44ef2e05757937c803285f59a686d85 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.io.*;
import java.util.*;
public class Contest1 {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | 606b58a2a09e3ce23c01fca7fb5be3dc | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.io.*;
import java.util.*;
public class C625C
{
static PrintWriter out = new PrintWriter((System.out));
public static void main(String args[]) throws IOException
{
Reader sc = new Reader();
int n=sc.nextInt();
long ar[]=new long[n];
long s[]=new long[n];
... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | 3388f3906e9bd1f3886dc5b1072f2253 | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class recc1320a {
static BufferedReader __in;
static PrintWriter __out;
static StringTokenizer input;
public static void main(String[] args) throws IOException {
__in = new BufferedR... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | aa216c31c99b5738e7dfb302322c9f5f | train_002.jsonl | 1583068500 | Tanya wants to go on a journey across the cities of Berland. There are $$$n$$$ cities situated along the main railroad line of Berland, and these cities are numbered from $$$1$$$ to $$$n$$$. Tanya plans her journey as follows. First of all, she will choose some city $$$c_1$$$ to start her journey. She will visit it, an... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long a[]=new long[n+1];
for(int i=0;i<n;i++)
a[i]=sc.nextLong();
int sum=0;
long max=0;
... | Java | ["6\n10 7 1 9 10 15", "1\n400000", "7\n8 9 26 11 12 29 14"] | 2 seconds | ["26", "400000", "55"] | NoteThe optimal journey plan in the first example is $$$c = [2, 4, 5]$$$.The optimal journey plan in the second example is $$$c = [1]$$$.The optimal journey plan in the third example is $$$c = [3, 6]$$$. | Java 11 | standard input | [
"dp",
"greedy",
"math",
"sortings",
"data structures"
] | aab8d5a2d42b4199310f3f535a6b3bd7 | The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of cities in Berland. The second line contains $$$n$$$ integers $$$b_1$$$, $$$b_2$$$, ..., $$$b_n$$$ ($$$1 \le b_i \le 4 \cdot 10^5$$$), where $$$b_i$$$ is the beauty value of the $$$i$$$-th city. | 1,400 | Print one integer — the maximum beauty of a journey Tanya can choose. | standard output | |
PASSED | 0ceac5dba6b267ff1a838affb742eaa1 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.*;
public class efficient{
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
HashMap<Integer,Integer> map = new HashMap<>();
for(int i = 0;i<n;i++){
int ele = s.nextInt();
map.put(ele,i);
}
int q = s.nextInt();
long vasya = 0;
lon... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 04caff606793cccb0f571973ed933dbd | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.Scanner;
public class codefo {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner ob =new Scanner(System.in);
int n=ob.nextInt();
int a[]=new int[100001];
for(int i=1;i<=n;++i)
{
int ne=ob.nextInt();
a[ne]=i;
}
int q=ob.nextInt();
long sum1=0,... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | f1c47a94a164bc17b9cd9623f2d909ec | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.util.stream.IntStream;
import static java.lang.Math.*;
import static java.util.Arrays.*;
@SuppressWarnings("ALL")
public class BEffectiveApproach {
public static void main(String[] $) throws IOException {
BEffectiveApproach o = new BEffectiveApproach();
... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 938712327dad252a41a0aaa1fbfe689a | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner input = new Scanner(System.in);
... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 6289ce3bdf524d0e3a04f18856754b8c | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | //package codeforces;
import java.io.*;
import java.util.*;
public final class Codeforces {
public static void main(String[] args) throws Exception{
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
FastReader sc ... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 7dccc4937d71f78735d506447aec12ec | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.*;
public class Prob86{
public static void main(String args[]){
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int arr[] = new int[n];
int temp[] = new int[n];
for(int i=0;i<n;i++){
arr[i] = s.nextInt();
temp[arr[i] - 1] = i;... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | b38e0ffae88782a77157e5e9f1721d1d | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class EffectiveApproach {
public static void main(String[] args) {
InputStream inputStream = Sy... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 439f7b68e48bec2491c5b5d733d2c1ec | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.*;
import java.math.*;
public class Euler {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n = in.nextInt();
Map<Integer,Integer> map = new HashMap<>();
for (int i = 0;i < n; i++) {
int x = in.nextInt();
map.put(x, i);
}
int q = in.... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 47f7ba6635ab12f404042b9eb04651ae | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 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 {
//Fast Reader
private static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 706aacebc31dd14f90f9dabd4d6e3e99 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
public class EffectiveApproach {
static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
public static void main(String [] args) throws IOExcep... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | aad82b5e99f5e750549cb22333631d69 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.*;
public class L30P227B_{
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int n=in.nextInt();
HashMap<Integer,Integer> h=new HashMap<Integer,Integer>();
for(int i=1;i<=n;i++){
h.put(in.nextInt(), i);
}
int q=... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | b9a0552930f59599cf033e203fb284c5 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.io.*;
import java.util.*;
public class S {
static BufferedReader reader;
static StringTokenizer tokenizer;
/** call this method to initialize reader for InputStream */
static void init(InputStream input) {
reader = new BufferedReader(
new InputStreamReader(inp... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | e955ba58afb06e5baf49408bcc58631f | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes |
import java.util.*;
public class Main{
public static void main(String []args){
Scanner scan=new Scanner(System.in);
int arrayLength = scan.nextInt();
int array[] = new int[100001];
for(int i=0;i<arrayLength;i++){
array[scan.nextInt()]= i;
}
... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 1dba9a6a3db877318922fdceb72e4888 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.*;
public class what
{
public static void main (String[] args)
{
Scanner l=new Scanner(System.in);
int n=l.nextInt();
int[] a=new int[n];
for(int i=0;i<n;i++)
a[i]=l.nextInt();
int[] b=new int[n+1];
for(int j=0;j<n;j++){
b[a[j]]=j+1;
}
long count=0;
long cou=0;
int m=l.nextInt();
fo... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 32b2a7a52d396abf0840d3862fad986d | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.HashMap;
import java.util.Scanner;
public class p7 {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
HashMap<Integer,Integer> hm=new HashMap<>();
for(int i=0;i<n;i++){
int num=s.nextInt();
hm.put(... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 127fc3275094111cf9a58a74dc91ce5f | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.*;
public class EffectiveApproach {
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
a[i]=sc.nextInt();
int m=sc.nextInt();
int b[]=new in... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 12253b0686b545a5206215d5702b3619 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import javax.swing.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*; import java.io.*;
/*
* untitled.java
* Copyright 2019 Karan Kanojia <karankanojia@Karans-MacBook-Air.local>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 8dca0a3d74c7a37275eb86e55e42c9b1 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.HashMap;
import java.util.Scanner;
public class EffectiveApproach {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
HashMap<Integer ,Integer> map = new HashMap<>();
int[] arr = new int[n];
fo... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 6065d930fe0ff4549d3c4e6c4734671b | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.Scanner;
import java.util.HashMap;
import java.util.Map;
public class effectiveapproach {
private static HashMap<Integer, int[]> indexMap;
private static int arrayLength;
// create a hashmap<int, int[]> where the int is the query
// and the int[] contains the leftmost and rightmost index of the ... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 23e3e8441876beda2d61382225b2072b | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int [] arr = new int [n+1];
for (int i = 1 ; i <= n ; i++){
int a = in.nextInt();
arr[a] = i;
}
int m = in.nextInt();
long approchA = 0;
long approch... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 5d9722c083ae42cbe8d74dbec35f39aa | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes |
import java.util.HashMap;
import java.util.Scanner;
public class codfroc {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int[] a = new int[n];
HashMap<Integer,Integer> map = new HashMap<>(n);
for (int i = 0; i < n; i++) {... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | a60afdbd14e402cdc5d0883a68a8f5d0 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
// DRIVER CODE
public class Main {
public static void main(String[] args) throws IOException {
//Scanner in = new Scanner(System.in);
BufferedReader br = new BufferedReader(new InputStre... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | c223794a87dcad2a5f708387b4810512 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
// public static int petyaLS(int a[],int key){
// int comparisons=0;
// for (int i=a.length-1;i>-1;i--) {
// comparisons++;
// if (a[i]==key) return comparisons;
// }
// return comparisons;
// }
// public static int vasyaL... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | b9ea22d7471233dea932f389f29e513a | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.*;
public class dice{
public static void main(String args[]){
int n;
Scanner scan = new Scanner(System.in);
n=scan.nextInt();
int A[] = new int[n];
for(int i=0;i<n;i++){
A[i]=scan.nextInt();
}
HashMap<Integer,Integer> map=new HashMap<>();
... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 5f021ae84fff437d636174d8da0f87e1 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes |
import java.util.Scanner;
public class CodeForces
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a[] = new int[n+1];
for(int i=1;i<n+1;i++)
{
int x =sc.nextInt();
a[x] = i;
}
... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 99b59b2cd90f50299fda91f381decea3 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.Scanner;
public class test {
public static void main(String[] args) {
Scanner input =new Scanner(System.in);
int n=input.nextInt();
long[] arr=new long [100000+3];
long count1=0,count2=0;
int num;
for (int i = 0; i < n; i++) {
num... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | c5f99175338cb5ebff4ba7f557372f09 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | a7d4c29ed093c954d08a87bf39d53f50 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class Main {
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader() {
din = new Dat... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | b3195a12754edcd07f676046c274ccef | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | //package cp;
import java.util.*;
import java.io.*;
public class Solution
{
public static void main(String[] args)
{
FastScanner sc = new FastScanner();
int n = sc.nextInt();
int a[] = sc.readArray(n);
int m = sc.nextInt();
long v = 0;
long p = 0;
HashMap<Integer,Integer> map = new HashMap<>();
... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 883b9b3bc75203ba1b3d4b3ed2f5bb81 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.*;
public class Main {
public static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
// write your code here
int n = scanner.nextInt();
int arr[] = new int[100001];
for(int i = 1 ; i<= n ; i++){
arr[scanner.nextInt()] = i;
}
... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | eb226e3e37f5e7b6dfa91aff38957acb | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Codeforces227B {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < n; i++) {
... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | c5c8c04e122bd019b040b94a7378c733 | train_002.jsonl | 1348500600 | Once at a team training Vasya, Petya and Sasha got a problem on implementing linear search in an array.According to the boys, linear search works as follows. The array elements in a pre-selected order are in turn compared with the number that you need to find. Once you find the array element that is equal to the requir... | 256 megabytes | import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int n, m;
long v=0, p=0;
Map<Integer, Integer> as = new HashMap<>();
Scanner scanner = new Scanner(System.in);
n = scanner.nextInt();
... | Java | ["2\n1 2\n1\n1", "2\n2 1\n1\n1", "3\n3 1 2\n3\n1 2 3"] | 2 seconds | ["1 2", "2 1", "6 6"] | NoteIn the first sample Vasya's approach will make one comparison (it starts with the 1-st element and immediately finds the required number), and Petya's approach makes two comparisons (first he compares with the 2-nd array element, doesn't find the search item and compares with the 1-st element).In the second sample,... | Java 11 | standard input | [
"implementation"
] | b7aef95015e326307521fd59d4fccb64 | The first line contains integer n (1 ≤ n ≤ 105) — the number of elements in the array. The second line contains n distinct space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of array. The third line contains integer m (1 ≤ m ≤ 105) — the number of queries. The last line contains m space-separated int... | 1,100 | Print two integers, showing how many comparisons Vasya's approach needs and how many comparisons Petya's approach needs. Separate the numbers by spaces. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier. | standard output | |
PASSED | 9984abe5b82d2a4c4dd875fe6b983e0c | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.io.*;
import java.util.*;
public class MainClass
{
static int INF = Integer.MAX_VALUE;
public static void main(String[] args)throws IOException
{
Reader in = new Reader();
int n = in.nextInt();
int m = in.nextInt();
int[] small = new int[n];
Arrays.fill(s... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 02505226303481e823f4da266c2e0319 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.util.*;
import java.io.*;
public class PashmakandGraph {
/************************ SOLUTION STARTS HERE ************************/
private static void solve() {
int V = nextInt();
int E = nextInt();
int edges[][] = new int[E]... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | c3c4ffd4ff48e5f7d404b3caf4a80b22 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | ;
import java.awt.*;
import java.io.*;
import java.util.*;
public class Abc {
public static void main(String[] args) throws IOException {
FastReader sc = new FastReader();
int n=sc.nextInt(),m=sc.nextInt();
ArrayList<Point> w[]=new ArrayList[100001];
for (int i=0;i<100001;i++)w[i]=n... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 75461c1f90f9639d3829a4c7d36ec352 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes |
// IS BAAR AC HO MADARCHOD
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class pashmakAndGraph {
static ArrayList<pair> adj[];
static void MainSolution() {
adj=new ArrayList[300005];
for(int i=0;i<300005;i++)a... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | d2217054105ffc2e46752e1dd31a43f2 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Map;
import java.util.StringTokenizer;
/*
public class _459E {
}
*/
public class _459E {
class edge {
int u... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | e0ebcc0f17b2ebc71e7be33933bf1823 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main implements Runnable {
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numCha... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 8859c1711eb1f40bdecdf68361723d87 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class E {
static int n,m,dp[],que[],dp2[];
static int M = 500000;
public static void main(String[] args) throws IOException {
/*
* 容易超时
*/
//Sc... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 529c83a92b69e1f3026a1a1331d3875a | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
/* spar5h */
//hm.get((long)0) != hm.get(0)
public class cf5 implements Runnable{
static class pair {
int i, j;
pair(int i, int j) {
this.i = i; this.j = j;
}
}
public void run() {
... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 4fc6596b24b45d845b284af1731eb590 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF_459E {
public static void main(String[] args) throws IOException {
new CF_459E().solve();
}
class vertex{
int[] curr={0,0}, prev={0,0};
void updateDest(int w, int l){
if (curr[1]<l){
if(w>curr[0]) ... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 7f358f233c1cc0590314dcd236664bcf | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.io.*;
import java.util.*;
public class E implements Runnable{
public static void main (String[] args) {new Thread(null, new E(), "_cf", 1 << 28).start();}
public void run() {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
System.err.println("Go!");
int n = fs... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | ad1910eb55bd68652dc9767b483c21a6 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
public class Round261E {
public static void solve() {
int n = s.nextInt();
int m = s.nextI... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 75ca9991755bf6a663c6f7be8d4a1785 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 256 megabytes | import java.awt.geom.Rectangle2D;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import sun.security.krb5.internal.crypto.dk.ArcFourCrypto;
public class E
{
String line;
StringTokenizer inputParser;
BufferedReader is;
FileInputStream fstream;
DataInputStream in;
void openInput(String file)... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 2870a20a8de506a89912eba713d70d45 | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 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.util.ArrayList;
import java.util.List;
import java.io.Writer;
impo... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output | |
PASSED | 6c5dd35e0bddddec299da8c21713893e | train_002.jsonl | 1408116600 | Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the problem.You are given a weighted directed graph with n vertices and m edges. You need to find a path (perhap... | 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.List;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.io.InputStream;
/**
* @author khokharnikunj8
*... | Java | ["3 3\n1 2 1\n2 3 1\n3 1 1", "3 3\n1 2 1\n2 3 2\n3 1 3", "6 7\n1 2 1\n3 2 5\n2 4 2\n2 5 2\n2 6 9\n5 4 3\n4 3 4"] | 1 second | ["1", "3", "6"] | NoteIn the first sample the maximum trail can be any of this trails: .In the second sample the maximum trail is .In the third sample the maximum trail is . | Java 8 | standard input | [
"dp",
"sortings"
] | bac276604d67fa573b61075c1024865a | The first line contains two integers n, m (2 ≤ n ≤ 3·105; 1 ≤ m ≤ min(n·(n - 1), 3·105)). Then, m lines follows. The i-th line contains three space separated integers: ui, vi, wi (1 ≤ ui, vi ≤ n; 1 ≤ wi ≤ 105) which indicates that there's a directed edge with weight wi from vertex ui to vertex vi. It's guaranteed that ... | 1,900 | Print a single integer — the answer to the problem. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.