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 | fe33a189836f413b91bb7a0873654497 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.awt.*;
import java.io.*;
import java.util.*;
public class Abc {
static int dp[][],n,arr[][];
public static void main(String[] args) {
FastReader sc = new FastReader();
n=sc.nextInt();
arr=new int[n][3];
dp=new int[n][2];
for (int i=0;i<n;i++){
arr... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | a4dfa9eae6f61faeeb83b160c467d8a4 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.util.*;
public class Main {
static long mod = 1000000007;
static int size = 200000;
static long[] fac = new long[size];
static long[] finv = new long[size];
static long[] inv = new long[size];
static int INF = Integer.MAX_VALUE;
//Dima and Hares
public static void main(String[] args){
Scanner s... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | bea53e481d738d57e6df58f11949d36a | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class D208 {
static int N;
static long[] a, b, c;
static long[][] memo;
public static void main(String[] args) {
FS scan = n... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | b0dae1e0f476d09bc99dfdfd419fb0ac | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class D385 {
public static void main(String[] args) {
MyScanner in = new MyScanner();
int n = in.nextInt();
int[] a = new int[n];
int[] b = new int... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | f41bdab50372876df0c0fe5ebc42f5df | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
public static void main (String[] args) {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int oo = (int)1e9;
int n = fs.nextInt();
int[] a = fs.nextIntArray(n);
int[] b = fs.ne... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 3042ca5156bb9cfd2baa45871ba26f60 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | // Utilities
import java.io.*;
import java.util.*;
public class Main {
static int N;
static int[] a, b, c;
static int[][] dp; // [idx][person before idx full ? 1 : 0]
public static void main(String[] args) throws IOException {
N = in.iscan();
a = new int[N]; b = new int[N]; c = new int[N];
for (int i = 0; ... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | a804197238fd0e773b02bcfaaeb4c528 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | /*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
impor... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 5249a8af13433c55ae9d05ab33ae9f0f | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;
/**
* Created by Katushka on 08.02.2020.
*/
public class DimaAndHares {
static int[] readArray(int size, InputReader in) {
int[] a = new int[size];
for (int i = 0... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | f0874d0196779835bbe0f36e654daf6b | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | /*
Keep solving problems.
*/
import java.util.*;
import java.io.*;
public class CFA {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
final long MOD = 1000L * 1000L * 1000L * 2 + 7;
int[] dx = {-1, 1, 0, 0};
int[] dy = {0, 0, -1, 1};
int n;
int[][] dp;
i... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | e3e238c3dcd945edef5fe361884df0ef | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int n = In... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | a9326281ea239f4cd6b0059aa62b16c7 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class D358 {
int[][] dp, a;
void solve(){
int n = readInt();
a = new int[3][n];
for(int i = 0;i<3;i++){
for(int j = 0;j<n;j++){
a[i][j] =... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | d69046cb779c652b8b0c688e0b91e3c8 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static class Reader
{
private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
public int read() {if (nu... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 0a4ed760a6ecac7431e0c92e56455740 | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.System.in;
public class Main {
static int n,m;
// static ArrayList<Integer>[] graph,tree;
public static void main(String[] args)throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
//Scanner... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 15eebfd52dcc98ecdcd11a8eed1322ae | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class D358 {
public static void main(String[] args) throws IOException {
BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));
int size = Integer.parseInt(inp.readLine());
... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 94d930b132b8578ea24800248e7f64fd | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Abood2C {
static int n, a[], b[], c[];
static int memo[][];
static int solve(int i, int l... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 829fd80bbf4863df71b33f601cbed46d | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | import javafx.scene.layout.Priority;
import java.io.*;
import java.lang.reflect.Array;
import java.net.Inet4Address;
import java.util.*;
import java.lang.*;
import java.util.HashMap;
import java.util.PriorityQueue;
public class templ implements Runnable {
static class pair implements Comparable
{
int f... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | db9f3ed9b7a5fa2099532b323555a5bb | train_002.jsonl | 1382715000 | Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her n hares. Inna was very happy. She lined up the hares in a row, numbered them from 1 to n from left to right and started feeding them with car... | 256 megabytes | //package que_b;
import java.io.*;
import java.util.*;
import java.math.*;
public class utkarsh {
InputStream is;
PrintWriter out;
long mod = (long) (1e9 + 7), inf = (long) (3e18);
boolean SHOW_TIME, debug;
void solve() {
//Enter code here utkarsh
//SHOW_TIME = true;
//... | Java | ["4\n1 2 3 4\n4 3 2 1\n0 1 1 0", "7\n8 5 7 6 1 8 9\n2 7 9 5 4 3 1\n2 3 3 4 1 1 3", "3\n1 1 1\n1 2 1\n1 1 1"] | 2 seconds | ["13", "44", "4"] | null | Java 8 | standard input | [
"dp",
"greedy"
] | 99cf10673cb275ad3b90bcd3757ecd47 | The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of hares. Then three lines follow, each line has n integers. The first line contains integers a1 a2 ... an. The second line contains b1, b2, ..., bn. The third line contains c1, c2, ..., cn. The following limits are fulfilled: 0 ≤ ai, bi, ci ≤ 1... | 1,800 | In a single line, print the maximum possible total joy of the hares Inna can get by feeding them. | standard output | |
PASSED | 34a98fc7cd741ebca1fc972c65fa8411 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.util.Scanner;
public class Ishu
{
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
int n,i,min=0,max=0,mi=0,Mi=0;
int[] a=new int[1000];
n=scan.nextInt();
for(i=0;i<n;++i)
{
a[i]=scan.nextInt();
if(i==0)
{
min=max=a[i];
mi=Mi=i+1;
}
else if(a[i]<min... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | a08200202cd7dd50ac935e2b365f3c1c | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String [] args)
{
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int x[] = new int[n];
int sum=0;
for(int i=0 ;i<n ;i++)
{
x[i]= scan.nextInt();
sum += x[i];
... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 4e44f3127e82c84f72c42e2451bb0269 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
@SuppressWarnings("unchecked")
public class P99B {
class Cup implements Comparable<Cup> {
int n, v;
public Cup(int n, int v) {
this.n = n;
this.v = v;
}
@Override
public int compareTo(Cup c) {
... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | d5f5f145d5bfe70043e5a050af3c7462 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.Set;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 13a5c87d58cd20eaf1827d0cec32204d | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Mouna Cheikhna
*/
public class Main {
publ... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 68201892442a6c3834cc15eb3c9693d3 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import javax.print.attribute.HashDocAttributeSet;
import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) {
MyScanner scanner = new MyScanner();
int n = scanner.nextInt(), x = 0, y = 0, other = 0;
HashMap<Integer, Integer> maps = new HashMap<Integer, ... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 0d765f8a8839f2eb3673381bd25019d2 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
/**
* Created by jizhe on 2016/1/8.
*/
public class HelpChefGerasim {
public static class FasterScanner {
private byte[] buf = new byte[1024];
private int curChar;
pr... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 8e83921557d2dd0006914b8ad022fb82 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 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.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
public class P99B {
public static void main(String[] ar... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 877e712deaff7a3bde544e4ae5aad572 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String arg[]) {
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.next());
List<Integer> list = new ArrayList<>();
for(int i = 0; i < n; ++i){
list.add(Integer.parseInt(sc.next()));
}
... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 18e060929b46b8b27c75df7778f6a0a7 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;
public class b78 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
HashMap<Integer,Integer> cups = new HashMap<Integer,Integer>();
ArrayList<Integer> act... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | b63ad31062e1d2f28244cc22982a9be2 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.*;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Double.parseDouble;
import static java.lang.String.*;
public class Main {
public static void main(String[] args) throw... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | e2b81e5d8df9507d3d3679e232f679a1 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.util.*;
import java.io.*;
public class b
{
public static void main(String[] arg) throws IOException
{
new b();
}
public b() throws IOException
{
FastScanner in = new FastScanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int[] vs = new int[n];
for(int ... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | bc0cfa30adfe4ba57a19aa00ca23b66a | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.util.*;
import java.io.*;
public class Help_Chef_Gerasim {
public static void main(String[] args) throws java.lang.Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(br.readLine());
int a[]=new int[n],b[]=new int[n];
for(int i=0; i<n; i++)... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 4096ee0428502d3873b9657d65f5c0c9 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 190f6740a09266c97600ac6451511218 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.*;
public class Main
{
public static void ans(int []arr,int sum,int n){
if(sum%n!=0){
System.out.println("Unrecoverable configuration.");
... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | a5baf27a11d1b60d0bfffba3932951c6 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes |
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
public class Main{
public static void main(String[]args)throws IOException{
PrintWriter pw=new PrintWriter(System.out,true);
BufferedReader bf=new BufferedReader(new... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | e2e54934a61f0395ea21151058458073 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main implements Runnable {
public void solve() throws IOException {
int N = nextInt();
int[] milk = new int[N];
for(int i = 0; i < N; i++) milk[i] = nextInt();
int sum = 0;
... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 60da87317a2445e2735b527f75800121 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes |
import java.io.*;
import java.util.*;
public class B
{
public static void main(String args[])throws IOException
{
new B().run();
}
void run()throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(in.readLine());
int a[]=new int[n];
int temp[]... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 86f2999f1df7d17d46a670dbda0f3351 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.BufferedReader;
//import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
//import java.io.FileReader;
//import java.io.FileWriter;
//import java.lang.StringBuilder;
//import java.util.StringTokenizer;
//import java.lang.Comparable;
//impo... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | fc6b3cf565e733694cc79064c9be25d4 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 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 | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 66d6f652bcbf28c148f1eb08f3af5466 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.text.DecimalFormat;
import java.lang.Math;
import java.util.Iterator;
public class b88{
... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | ef3cf40a238935c41594a7e51f4f7ee3 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
public class HelpChefGerasim {
static class Cal implements Comparable<Cal>{
int in=0,val=0,count=0;
Cal(){
in=0;
val=0;
count=0;
}
public int compareTo(Cal o){
if(count!=o.count)
... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 5bcb6e8e2e8855577aad5ddd62add4f6 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class popo {
public static boolean prime[];
public static ArrayList[] ad=new ArrayList[2555];
public static ArrayList<Long> xor1,xor2;
public static void main(String[] args) {
InputR... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | e93311b5eeb64e3a446e6a16052d0d0f | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.net.URL;
import java.util.*;
public class Template implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws FileNotFoundException {
try {
in = new Buffered... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 66a61a29ea17851d96a5a2955ab8a3e4 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
import java.util.HashSet;
import java.util.List;
import java.io.IOException;
import java.util.Arrays;
import java.util.I... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | be4b85f832d33087a12db2de056d340f | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | import java.util.Scanner;
public class Main
{
public static Scanner in = new Scanner(System.in);
public static void main(String[] args) throws Exception
{
int n;
n=in.nextInt();
double sum=0;
int a[]=new int[1001];
for(int i=0;i<n;i++)
{
a[i]=in.next... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | b5019575b76a35d09774735ccf3849f7 | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes |
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class HelpChefGerasim implements Closeable {
private InputReader in = new InputReader(System.in);... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 196ac7a44f712b0574fc5a99997b42ac | train_002.jsonl | 1311346800 | In a far away kingdom young pages help to set the table for the King. As they are terribly mischievous, one needs to keep an eye on the control whether they have set everything correctly. This time the royal chef Gerasim had the impression that the pages have played a prank again: they had poured the juice from one cup... | 256 megabytes | //package codeforces;
import java.io.BufferedReader;
import java.io.Closeable;
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.Comparator;
import java.util.HashMap;
import java.... | Java | ["5\n270\n250\n250\n230\n250", "5\n250\n250\n250\n250\n250", "5\n270\n250\n249\n230\n250"] | 0.5 second | ["20 ml. from cup #4 to cup #1.", "Exemplary pages.", "Unrecoverable configuration."] | null | Java 8 | standard input | [
"implementation",
"sortings"
] | 7bfc0927ea7abcef661263e978612cc5 | The first line contains integer n — the number of cups on the royal table (1 ≤ n ≤ 1000). Next n lines contain volumes of juice in each cup — non-negative integers, not exceeding 104. | 1,300 | If the pages didn't pour the juice, print "Exemplary pages." (without the quotes). If you can determine the volume of juice poured during exactly one juice pouring, print "v ml. from cup #a to cup #b." (without the quotes), where v represents the volume of poured juice, a represents the number of the cup from which the... | standard output | |
PASSED | 762958faa934cef8788f027cad706973 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Roads {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); // para
String line;
while ((line = in.readLi... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 341f7fd5b01d1c1169baefde81766fb1 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.io.*;
import static java.lang.Math.*;
import java.util.*;
import java.util.function.*;
import java.lang.*;
public class Main {
final static boolean debug = false;
final static String fileName = "";
final static boolean useFiles = false;
public static void main(String[] args) throws FileNot... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 636c12f75c133b5f44b6ac927098402d | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.Scanner;
public class MyClass {
public static void main(String args[]) {
Scanner kb=new Scanner(System.in);
int cities=kb.nextInt();
int [][]mat=new int [cities][cities];
for(int i=0;i<cities;i++){
for(int j=0;j<cities;j++){
mat[i][j]=kb.... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 9620735699a77ab600d47d7d651b78f5 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.Scanner;
public class Problem6 {
static int n;
static int m;
static int[][] dist;
public static void main( String[] args ) {
Scanner input = new Scanner( System.in );
// Get the number of cities
n = input.nextInt();
// Initialize the 2D distance array
dist = new int[n+1][n+1... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | ea09a27db773293d4c64850a7013bcce | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
long sum = 0;
int[][] d = new ... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | a6583db1577c6fbec5c75fe34c65cd2c | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | /*
Keep solving problems.
*/
import java.util.*;
import java.io.*;
public class CFA {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
private static final long MOD = 1000 * 1000 * 1000 + 7;
private static final int[] dx = {0, -1, 0, 1};
private static final int[] dy = ... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | c856f6dcbe4f3001474118227b504f42 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.StringTokenizer;
/**
* 25C
*
* @author artyom
*/
public class RoadsInBerland implements Runnable {
private BufferedReader in;
private PrintStream out;
private String... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 94f42e2cb4a72b9a640413b27074109d | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class RoadsInBerland {
static int n,AdjMat[][];
static long sum;
public static void Warshall(int a,int b,int c)
{
for (int i=0;i<n;i++)
{
for (int j=0;j<n;j++)
{
... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 35e639b6794b220f8cadd3a4efe22469 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.*;
public class Berland {
private static int[][] dis;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
long sum = 0;
int a, b, c;
int n = scanner.nextInt();
int[][] m = new int[n][n];
for (int i = 0; i < n; i++)... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | c57b8c2d7dcf678a3ddc67522d350644 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes |
import java.util.Scanner;
public class RodesinBerlandB25C100th
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
StringBuilder ans=new StringBuilder();
int n=s.nextInt();
long p[][]=new long[n][n];
for(int i=0;i<n;i++)
{
... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 76e552610d8c92027e74def18c5e24dc | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static class Reader
{
private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
public int read() {if (nu... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 1bf3839e61193f23923d5ff45645697b | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.Scanner;
import java.math.*;
import java.lang.*;
import java.io.*;
public class Main{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
long[][] g = new long[n][n];
for(int i=0;i<n; i++) {
for(int j=0; j<n; j++) {
g[i][j] = scan.next... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | ca44a051299f6706ee466963f921d28b | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class RoadsInBerland {
static int [][] grid;
static int V;
static final int oo = (int)1e9;
pub... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 970d838b56f7bec415f353999b0cc60a | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//package CP;
import java.io.*;
import java.util.*;
public class C25
{
public static void main(String args[])throws IOException
... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 39828e71114db9c888a6c4f5c022c474 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.io.*;
import java.util.*;
public class RoadsInBerland{
static int MAX = 301;
static int INF = Integer.MAX_VALUE;
static int matrix[][] = new int[MAX][MAX];
static int min(int a , int b){
return a <= b ? a : b;
}
static long findSum(int a, int b , int weight, int n, long oldSum){
//a new road is a... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 3f086c3826cdaeda73431f32a8c8d463 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes |
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class A {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
int adj[][] = new int[n][n];
int dist[][] = new int[n]... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 3a48edbcfd79d97d9717c5d964cc6a9e | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | /**
* Created by Alex on 10/20/2014.
*/
import java.io.*;
import java.util.*;
public class C25 {
BufferedReader br;
StringTokenizer in;
PrintWriter out;
public String nextToken() throws IOException {
while (in == null || !in.hasMoreTokens()) {
in = new StringTokenizer(br.readLin... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | d3f9abd43e4b0dfdc8ada15edfe6be0a | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
static class InputReader{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = st... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | be8b4f66b0a5fa3ec7493e6b3a888b5f | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | // http://codeforces.com/problemset/problem/25/C
import java.io.*;
import java.util.InputMismatchException;
public class RoadsInBerland {
public static void main(String[] args) throws IOException {
InputReader in = new InputReader(System.in);
OutputWriter out = new OutputWriter(System.out);
... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | bcade4b35636da65c9d779ea99bd993d | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.Scanner;
/**
* @author Anton Bobukh <abobukh@yandex-team.ru>
*/
public class Roads {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[][] m = new int[n][n];
for (int i = 0; i < n; i++) {
... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | d11ec059c5ca21a6f8559bacca274fc9 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.Scanner;
import java.math.*;
import java.lang.*;
import java.io.*;
public class Main{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
long[][] g = new long[n][n];
for(int i=0;i<n; i++) {
for(int j=0; j<n; j++) {
g[i][j] = scan.next... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 312f54c872376eb7221a563845224fa4 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | // package Practice1.CF25;
import java.util.Scanner;
public class CF025C {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
long[][] graph = new long[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 8 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 3f9b855bd32a56e7c2c95896e74cda96 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.*;
public class P025C {
private class Pair {
private int i;
private int j;
private Pair(int i, int j) {
this.i = Math.min(i, j);
this.j = Math.max(i, j);
}
public int hashCode() {
return 37 * i + j;
}
... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | e631f2a597fd87c178bb461379465463 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main implements Runnable {
private BufferedReader in;
private PrintWriter out;
private StringTokenizer st;
private void eat(String line)
{
st = new StringTokenizer(line);
}
private String next() throws IOException
{
while(!st.hasMoreTokens()) {
Stri... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 585f02ba03e9379d6bb2ddfc45a12760 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import static java.lang.Math.min;
import java.util.Arrays;
import java.util.Scanner;
public class R025C {
public void debug(Object... objects) { System.err.println(Arrays.deepToString(objects)); }
public static final int INF = 987654321;
public static final long LINF = 987654321987654321L;
public sta... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 3f14278a862fe3c3871fc67be2a3df85 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class C {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[][] d = new int[n][n];
f... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 9b8f8de273bc4498543c5b0599729704 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import static java.lang.Math.min;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.StringTokenizer;
public class Main implements Runnable {
void solve() throws IOException {
int n = nextInt()... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | daa86be99e54066c882931f0e5de6bf7 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.io.*;
import java.util.*;
public class RoadsInBerland {
public void solve() throws IOException {
int n = nextInt();
long[][] d = new long[n][n];
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
d[i][j] = nextInt();
int k = nextInt();
... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | be30fb09307ec7fd92d7605d3a860424 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.*;
import java.io.*;
public class CodeForces {
static int[][] G;
static StringBuilder sol;
static long totalDist;
public static void main(String[] args) throws Exception{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
sol = new StringBuilder("");
int N = Integer.... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 6b114d46451993d0650b2c733e562027 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
public class C {
public static void main(String[] args) throws Exception {
new C().run();
}
private StreamTokenizer st;
private void run() throws Exception {
st = new StreamTokenizer(new BufferedReader(new Inpu... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 1128f2590f719dabe526ddd5fa30b5f8 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.Scanner;
public class C {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt(); // 2-300
int[][] a = new int[n][n];
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
a[i][j] = scan.nextInt();
}
}
String... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 11ecbc83e1b0bb96e3b10b8cf63a8f33 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.Scanner;
public class C {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt(); // 2-300
int[][] a = new int[n][n];
long sum = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
sum += (a[i][j] = scan.next... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | d3cff499c25b9cc1a7c150359ff8cf25 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.*;
public class c {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[][] graph = new int[n][n];
long sum = 0;
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++) {
graph[i][j] = in.nextInt();
if(i<j)
sum += graph[i][j];
}... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 4b5c060e4d1605e5f494d7d179c30f3c | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 256 megabytes | import java.util.*;
import java.io.*;
public class C
{
private static int[][] M;
private static int n;
public static void main(String[] args) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
n = Integer.parseInt(in.readLine());
M = new int[n][n];
for (int i = 0... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 30ca3eb00aa8fb9fed14ef27163604b8 | train_002.jsonl | 1280761200 | There are n cities numbered from 1 to n in Berland. Some of them are connected by two-way roads. Each road has its own length — an integer number from 1 to 1000. It is known that from each city it is possible to get to any other city by existing roads. Also for each pair of cities it is known the shortest distance betw... | 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();
long dist[][] = new long[n][n];
for ( int i = 0 ; i < n ; ++i ) {
for ( int k = 0 ; k < n ; ++k ) {
dist[i][k] = in.nextLong();
}
}
int t = in.nextI... | Java | ["2\n0 5\n5 0\n1\n1 2 3", "3\n0 4 5\n4 0 9\n5 9 0\n2\n2 3 8\n1 2 1"] | 2 seconds | ["3", "17 12"] | null | Java 6 | standard input | [
"shortest paths",
"graphs"
] | 5dbf91f756fecb004c836a628eb23578 | The first line contains integer n (2 ≤ n ≤ 300) — amount of cities in Berland. Then there follow n lines with n integer numbers each — the matrix of shortest distances. j-th integer in the i-th row — di, j, the shortest distance between cities i and j. It is guaranteed that di, i = 0, di, j = dj, i, and a given matrix ... | 1,900 | Output k space-separated integers qi (1 ≤ i ≤ k). qi should be equal to the sum of shortest distances between all pairs of cities after the construction of roads with indexes from 1 to i. Roads are numbered from 1 in the input order. Each pair of cities should be taken into account in the sum exactly once, i. e. we cou... | standard output | |
PASSED | 041d1227db29c78a56a55dfdeec6b899 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes |
import java.util.*;
public class JavaApplication168<T> {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long k = sc.nextLong();
if(n == 1){
System.out.println(0);
return;
}
long a[] =... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 1cf051713e8f36df9ffa4fdc845496ca | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
long[] data = new long[input.nextInt()];
long n = input.nextInt();
for (int i = 0; i < data.length; i++) {
data[i] = input.nextLong()... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 25aea424642f7a268b6ca61835544f9e | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
long[] data = new long[input.nextInt()];
long n = input.nextInt();
for (int i = 0; i < data.length; i++) {
data[i] = input.nextLong()... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 678b4b7876ee437d55b7e1e06e365bd2 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes |
import java.util.*;
import java.io.*;
public class A {
static final boolean stdin = true;
static final String filename = "";
static FastScanner br;
static PrintWriter pw;
public static void main(String[] args) throws IOException {
if (stdin) {
br = new FastScanner();
pw = new PrintWriter(new OutputStr... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | b4755523a21a867cf51e23e36ea8ce54 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Question793A {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
long k=sc.nextLong();
int[] arr=new int[n];
int min=Integer.MAX_VALUE;
for(int i=0;i<n;i++){... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 18c0ae028f6bdf33ee480a815d686033 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes |
import java.util.*;
public class Solution
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int x=sc.nextInt();
int[] a=new int[n];
for(int i=0;i<n;i++)
{
a[i]=sc.nextInt();
... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | abe951a42b3deae257ee56c3fa7c9af8 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes |
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author SteinOr
*/
public class Oleg_And_Shares_793A {
public static void main(St... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 5368094b3652fdfd6a5f68b5f26202b0 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes |
import java.util.Scanner;
public class A_OlegAndShares {
public static void main(String[] args) {
Scanner s=new Scanner (System.in);
//************************** Var ******************
int n,k;
n=s.nextInt(); k=s.nextInt();
long a[]=new long[n]; ... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 8ea17d3ec0bc9e9957ce3610df8ca7cc | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import jav... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 3f4a4ffdd982dd36bd226ec7444c95a1 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
long k = scn.nextInt();
int[] mas = new int[n];
long c = 0;
Arra... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 5a2b267af0d440994fd9eb3a435bbbd4 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.util.Scanner;
public class main {
public static void main(String[] args){
Scanner in =new Scanner(System.in);
int x=in.nextInt();
int y=in.nextInt();
int[] s=new int[x];
int n,l=1000000000,r=0;
long m=0;
for(n=0;n<x;n++){
s[n]=in.nextInt();
l=Math.min(l,s[n]);
}
for(n=0;n<x;n++){
if((s[n]-l)%... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 2b7f88a570cdcfd608247ead6719abed | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.util.Scanner;
public class oas
{ public static void main(String args[])
{ Scanner s= new Scanner(System.in);
int n=s.nextInt();
int r=0,i;
long add=0;
int k=s.nextInt();
int a[]=new int[n];
a[0]=s.nextInt();
int temp=a[0];
if(n==1)
System.out.print(0);
else
{
for( i=1; i<n; i++)
{ a[i]=... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | e476a8410657989626969c20f4b63702 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class Main {
static Scanner in = new Scanner();
static PrintWriter out = new PrintWriter(System.out);
public static void main(String... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 722b799fba75b46d268b97190a0e8690 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
static int a[]=new int[100010];
public static void main(String[] args) {
int n,k,i,min=1000000010;
BigInteger ans=BigInteger.valueOf(0);
Scanner in = new Scanner(System.in);
n=in.nextInt();
k=in... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 662475b4412ac00d52a10c4a82846ccd | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.io.*;
import java.util.*;
public class OlegAndShares{
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] vals = br.readLine().split(" ");
int n = Integer.parseInt(vals[0]);
int k = Integer.parseInt(vals[1]);
... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | dd71c1527c59c43d4f90c607b1ff4356 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
public class Main {
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, by... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 1e91fedf4033165fcdf136ac4961383e | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
public final class CF_Tinkoff_Shares{
static void log(int[] X){
int L=X.length;
for (int i=0;i<L;i++){
logWln(X[i]+" ");
}
log("... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 3e06d1e8dd892547b5928cccbf0c7378 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import javafx.util.Pair;
import static java.lang.Double.parseDouble;
import static java.lang.Integer.max;
import static java.lang.Integer.min;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.StrictMath.abs;
import static java.lang.System.exit;
import static jav... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | 9ec4d9dde2615395e11df27b0639b361 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner ob= new Scanner(System.in);
int n=ob.nextInt();
int k= ob.nextInt();
long a[]= new long[n];
long s=0;
long min=Integer.MAX_VALUE;
for(int i=0; i<n; i++)
{
... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output | |
PASSED | cd60806ab2ad2fb1175b3aa8fda9f716 | train_002.jsonl | 1492965900 | Oleg the bank client checks share prices every day. There are n share prices he is interested in. Today he observed that each second exactly one of these prices decreases by k rubles (note that each second exactly one price changes, but at different seconds different prices can change). Prices can become negative. Oleg... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
/**
* Built using CHel... | Java | ["3 3\n12 9 15", "2 2\n10 9", "4 1\n1 1000000000 1000000000 1000000000"] | 1 second | ["3", "-1", "2999999997"] | NoteConsider the first example. Suppose the third price decreases in the first second and become equal 12 rubles, then the first price decreases and becomes equal 9 rubles, and in the third second the third price decreases again and becomes equal 9 rubles. In this case all prices become equal 9 rubles in 3 seconds.Ther... | Java 8 | standard input | [
"implementation",
"math"
] | 9e71b4117a24b906dbc16e6a6d110f50 | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 109) — the number of share prices, and the amount of rubles some price decreases each second. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the initial prices. | 900 | Print the only line containing the minimum number of seconds needed for prices to become equal, of «-1» if it is impossible. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.