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 | 96b3eb00354d02c9fee505c222a9ef8b | train_000.jsonl | 1526395500 | You work in a big office. It is a 9 floor building with an elevator that can accommodate up to 4 people. It is your responsibility to manage this elevator.Today you are late, so there are queues on some floors already. For each person you know the floor where he currently is and the floor he wants to reach. Also, you k... | 256 megabytes | import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
public class C {
static BufferedReader br;
static StringTokenizer st;
static PrintWriter pw;
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStre... | Java | ["2\n3 5\n5 3", "2\n5 3\n3 5"] | 3 seconds | ["10", "12"] | Note Explaination for the first sample t = 0 t = 2 t = 3 t = 5 t = 6 t = 7 t = 9 t = 10 | Java 8 | standard input | [
"dp",
"graphs",
"shortest paths"
] | f6be5319ad3733d07a8ffd089fc44c71 | The first line contains an integer n (1 ≤ n ≤ 2000) — the number of employees. The i-th of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 9, ai ≠ bi) — the floor on which an employee initially is, and the floor he wants to reach. The employees are given in the order they came to the elevator. | 2,400 | Print a single integer — the minimal possible time in seconds. | standard output | |
PASSED | 95f7c9d9dd9d99077e4adadd0a6062f3 | train_000.jsonl | 1526395500 | You work in a big office. It is a 9 floor building with an elevator that can accommodate up to 4 people. It is your responsibility to manage this elevator.Today you are late, so there are queues on some floors already. For each person you know the floor where he currently is and the floor he wants to reach. Also, you k... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
import java.math.*;
public class C {
public static void main(String[] args) throws IOException {
/**/
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
/*/
Scanner sc = new Scanner(new BufferedReader(new I... | Java | ["2\n3 5\n5 3", "2\n5 3\n3 5"] | 3 seconds | ["10", "12"] | Note Explaination for the first sample t = 0 t = 2 t = 3 t = 5 t = 6 t = 7 t = 9 t = 10 | Java 8 | standard input | [
"dp",
"graphs",
"shortest paths"
] | f6be5319ad3733d07a8ffd089fc44c71 | The first line contains an integer n (1 ≤ n ≤ 2000) — the number of employees. The i-th of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 9, ai ≠ bi) — the floor on which an employee initially is, and the floor he wants to reach. The employees are given in the order they came to the elevator. | 2,400 | Print a single integer — the minimal possible time in seconds. | standard output | |
PASSED | 0c6beb762d6d35351276ca3c2b32dbfb | train_000.jsonl | 1526395500 | You work in a big office. It is a 9 floor building with an elevator that can accommodate up to 4 people. It is your responsibility to manage this elevator.Today you are late, so there are queues on some floors already. For each person you know the floor where he currently is and the floor he wants to reach. Also, you k... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOExcept... | Java | ["2\n3 5\n5 3", "2\n5 3\n3 5"] | 3 seconds | ["10", "12"] | Note Explaination for the first sample t = 0 t = 2 t = 3 t = 5 t = 6 t = 7 t = 9 t = 10 | Java 8 | standard input | [
"dp",
"graphs",
"shortest paths"
] | f6be5319ad3733d07a8ffd089fc44c71 | The first line contains an integer n (1 ≤ n ≤ 2000) — the number of employees. The i-th of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 9, ai ≠ bi) — the floor on which an employee initially is, and the floor he wants to reach. The employees are given in the order they came to the elevator. | 2,400 | Print a single integer — the minimal possible time in seconds. | standard output | |
PASSED | b2c71dc24170f8f377084a0dfcee7fc0 | train_000.jsonl | 1526395500 | You work in a big office. It is a 9 floor building with an elevator that can accommodate up to 4 people. It is your responsibility to manage this elevator.Today you are late, so there are queues on some floors already. For each person you know the floor where he currently is and the floor he wants to reach. Also, you k... | 256 megabytes | //package com.company;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
static long TIME_START, TIME_END;
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
// Scanner sc = new Scanner(new FileInputStream("Test.... | Java | ["2\n3 5\n5 3", "2\n5 3\n3 5"] | 3 seconds | ["10", "12"] | Note Explaination for the first sample t = 0 t = 2 t = 3 t = 5 t = 6 t = 7 t = 9 t = 10 | Java 8 | standard input | [
"dp",
"graphs",
"shortest paths"
] | f6be5319ad3733d07a8ffd089fc44c71 | The first line contains an integer n (1 ≤ n ≤ 2000) — the number of employees. The i-th of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 9, ai ≠ bi) — the floor on which an employee initially is, and the floor he wants to reach. The employees are given in the order they came to the elevator. | 2,400 | Print a single integer — the minimal possible time in seconds. | standard output | |
PASSED | 9be20536c808c745f13ebf002251cbef | train_000.jsonl | 1526395500 | You work in a big office. It is a 9 floor building with an elevator that can accommodate up to 4 people. It is your responsibility to manage this elevator.Today you are late, so there are queues on some floors already. For each person you know the floor where he currently is and the floor he wants to reach. Also, you k... | 256 megabytes | import java.util.Scanner;
import java.util.Arrays;
public class Test7 {
int maxn = 3000;
//floors: 0 - 8
//9 - empty
//front: the next employee
//the importance of a: if a < 9 then the lift is full; else a - 9 means the floor the elevator is on
public static int hash(int front, int a, int b, i... | Java | ["2\n3 5\n5 3", "2\n5 3\n3 5"] | 3 seconds | ["10", "12"] | Note Explaination for the first sample t = 0 t = 2 t = 3 t = 5 t = 6 t = 7 t = 9 t = 10 | Java 8 | standard input | [
"dp",
"graphs",
"shortest paths"
] | f6be5319ad3733d07a8ffd089fc44c71 | The first line contains an integer n (1 ≤ n ≤ 2000) — the number of employees. The i-th of the next n lines contains two integers ai and bi (1 ≤ ai, bi ≤ 9, ai ≠ bi) — the floor on which an employee initially is, and the floor he wants to reach. The employees are given in the order they came to the elevator. | 2,400 | Print a single integer — the minimal possible time in seconds. | standard output | |
PASSED | 6c18cc2e21fb010c22c4fc18eea426ff | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
String s[]=bu.readLine().split(" ");
int n=Integ... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | 38a74fccece57034182a94f02be49ca9 | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class TaskD {
static int n;
static int[] sum;
public static void main(String[] args) {
FastReader fs = new FastReader(System.in);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
n = fs.nextInt();
... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | d7391b20cb6105a68a70a89614f61dd6 | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import java.util.*;
import java.io.*;
public class TaskD2 {
static class Interval {
int start, end;
public Interval(int start, int end) {
this.start = start;
this.end = end;
}
@Override
public String toString() {
return "Interval{" +
... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | bf6d5d54d37413289a7d5f28ef9a7279 | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF302B extends PrintWriter {
CF302B() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF302B o = new CF302B(); o.main(); o.flush();
}
void main() {
int n = sc.nextInt();
int... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | caf0058977e73b45d5fa4001b7a2a91e | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | /**
* Author: Rohan Arora(codiinggeek)
*/
import java.io.*;
import java.util.*;
public class chad {
static long mod = (long) Math.pow(10, 9) + 7;
public static long binary(long val, ArrayList<Long> list){
long ans = -1;
int low = 0;
int high = list.size()-1;
while(low<=high)... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | d7892ebc3736a4e3852c63c5af43af9d | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.*;
import java.lang.*;
public class Main{
public static void main (String...args) throws IOException {
Scanner in = new Scanner(System.in);
BufferedWriter log = new BufferedWriter(new Outp... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | 799e190047f7e6bc3109e56918687ee6 | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF302B extends PrintWriter {
CF302B() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF302B o = new CF302B(); o.main(); o.flush();
}
void main() {
int n = sc.nextInt();
int m = sc.nextInt();
int[] aa = n... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | b5ec44a6802365dc1017bce5c581302b | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import org.w3c.dom.ls.LSOutput;
import java.util.*;
import java.lang.*;
import java.io.*;
public class RPS {
public static void main(String[] args) throws java.lang.Exception {
BufferedReader br = new BufferedReader(new InputStreamReader((System.in)));
StringTokenizer s = new StringTokenizer(br.r... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | 38d6a82de23d9e0d06fe686b34ee2300 | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Letters {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new Stri... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | 86544c634897f1668519ae55cf42fac8 | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 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 m = sc.nextInt();
long arr[] = new long[n];
for(int i=0; i<n;i++){
int c = sc.nextInt();
int t = sc.nextI... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | 85767dca7f092e663509304025036dc1 | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
BufferedWriter writer = new BufferedWriter(new OutputStreamWr... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | 6a7f80a733bd973355979d1bec80481c | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes |
import java.io.*;
import java.util.*;
/**
* User :- sudhakar
* Date :- 26/06/20
* Time :- 5:50 PM
*/
public class EugenyAndPlayList {
private static final Reader r = new Reader();
static final int MOD = 1000000007, SEIVE_SIZE = 10000000;
static final int MAX = Integer.MAX_VALUE;
static final int... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | 3ef727fd381e7f2a32fb4d02419ffdf3 | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes |
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class MainPlaylist {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int songsCount = sc.nextInt();
int timeCount ... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | c6b2359f49959a635f24e6427448c10b | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.*;
import java.lang.*;
public class Main {
public static void main (String[] args) throws IOException {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int m = i... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | 050cb0170c60a66bc07547ec1354cb5d | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | /* -------> Bismillahir Rahmanir Rahim <------*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class A {
private static final FastScanner in = new FastScanner();
// private static final Scanner in = new Scanner(System.in);
public s... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | ab966f93f76434351099bda429933f5d | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int m = input.nextInt();... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | b656b0b04466aefeaccd0e83e117a262 | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 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(), m = in.nextInt();
int[] range = new int[n];
int beg = 0;
for (int i = 0; i < n; i++) {
beg += in.nextInt() * in.nextI... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | be805b264b38c692e523f32b277547e4 | train_000.jsonl | 1367769900 | Eugeny loves listening to music. He has n songs in his play list. We know that song number i has the duration of ti minutes. Eugeny listens to each song, perhaps more than once. He listens to song number i ci times. Eugeny's play list is organized as follows: first song number 1 plays c1 times, then song number 2 plays... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
BufferedWriter writer = new BufferedWriter(new OutputStreamWri... | Java | ["1 2\n2 8\n1 16", "4 9\n1 2\n2 1\n1 1\n2 2\n1 2 3 4 5 6 7 8 9"] | 2 seconds | ["1\n1", "1\n1\n2\n2\n3\n4\n4\n4\n4"] | null | Java 11 | standard input | [
"two pointers",
"binary search",
"implementation"
] | c4398a9f342a23baf1d7ebc9f4e9577d | The first line contains two integers n, m (1 ≤ n, m ≤ 105). The next n lines contain pairs of integers. The i-th line contains integers ci, ti (1 ≤ ci, ti ≤ 109) — the description of the play list. It is guaranteed that the play list's total duration doesn't exceed 109 . The next line contains m positive integers v1, v... | 1,200 | Print m integers — the i-th number must equal the number of the song that was playing during the vi-th minute after Eugeny started listening to the play list. | standard output | |
PASSED | d6568822151e2a913650d43ef0530ed1 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception{
Scanner sc = new Scanner(System.in);
/*int a=sc.nextInt();
int b=sc.nextInt();
System.out.println(a^b);*/
int n = sc.nextInt();
BigInteger[]... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 3c805a7dfab2405a9d53737876bc6b50 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes |
import java.util.Scanner;
public class P252A
{
static Scanner in;
public static void main (String[] args)
{
in = new Scanner(System.in);
int n = in.nextInt();
int[] array = new int[n];
for (int i=0; i<n; i++)
array[i] = in.nextInt();
int result=0;
... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | a31ebed5ad86ce7aa3d403353f18cfdc | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private IO io;
private int ioMode = -1;
private String problemName = "";
private final String mjArgument = "master_j";
public static void main(String programArguments[]) throws IOException{
if(programArguments != null && programArgu... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 874c656107c161948c68765e3dc0effe | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A_252 {
FastScanner in;
PrintWriter out;
public void run() {
try {
in = new FastScanner(new InputStreamReader(System.i... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | c4051ed5d441b41154770504094a9620 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A_252 {
FastScanner in;
PrintWriter out;
public void run() {
try {
in = new FastScanner(new InputStreamReader(System.i... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | b7136dde7f2f956ca5ed5373d623b278 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A_252 {
FastScanner in;
PrintWriter out;
public void run() {
try {
in = new FastScanner(new InputStreamReader(System.i... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 2a10872b4b5de724418fc014654494ca | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 8b1e22be9e11412bd9243b044d1c4bd8 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author koval
*/
public class Main {
/**
... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | d27b183d69a6b955157abcd9e47feddd | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
/**
* User: andrey
* Date: 06.12.12
*/
public class Codeforces {
private static BufferedReader in;
private static PrintWriter out;
private StringTokenizer st;
public static void main(String[] args) throws IOException {
in = new BufferedRe... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 33c1999e9bb078e2344e284a569e71ec | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
/**
* User: andrey
* Date: 06.12.12
*/
public class Codeforces {
private static BufferedReader in;
private static PrintWriter out;
private StringTokenizer st;
public static void main(String[] args) throws IOException {
in = new BufferedRe... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | c72c1b96cd9ea991d406ffdb3557fa36 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.util.*;
public class A{
public static void main(String [] args){
Scanner s = new Scanner(System.in);
final int n = s.nextInt();
int [] x = new int[n];
for (int i = 0; i < n; ++i){
x[i] = s.nextInt();
}
int [] xor = new int[n + 1];
for (int i = 1; i <= n; ++i){
xor[i] ^= x[i - 1]^xor[i -... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 48b55c8b490a5c39b3bd2d971872a2ae | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.util.*;
public class A{
public static void main(String[] args){
Scanner s = new Scanner (System.in);
final int n = s.nextInt();
int [] a = new int[n];
for (int i = 0; i < n; ++i){
a[i] = s.nextInt();
}
int res = a[0];
for (int i = 0; i < n; ++i){
for (int j = i; j < n; ++j){
int xo... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 71fbb82e9aacb93fb16f5ca424a98fa2 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.util.Scanner;
public class Registers {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
final int n = sc.nextInt();
int [] a = new int[n];
for (int i = 0; i < n; ++i){
a[i] = sc.nextInt();
}
int res = -1;
... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | e7019b86407cbf2be26586a3d25ddb79 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | /* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(Syste... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 822c6b71c12d472915f741704a57f3dc | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
public class PashmakandGarden {
public static void main(String[] args) throws IOException {
PrintWriter out = new PrintWriter(new OutputStreamWriter(S... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | a5df7d96abb4d5a7b197064d2bbf0c26 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.util.*;
import java.io.PrintWriter;
import java.math.*;
public class Main {
void run(int nT) {
int n = cin.nextInt();
int[] num = new int[n];
int[] xor = new int[n];
for (int i = 0; i < n; ++i) {
num[i] = cin.nextInt();
xor[i] = num[i];
... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | f0b3516fa03b896cb6202d5f835ca5b3 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class P252A {
@SuppressWarnings("unchecked")
public void run() throws Exception {
int [] a = readInt(nextInt());
int mXor = 0;
for (int i = 0; i < a.length; i++) {
int xor = 0;
for (int j = i; j < a.length; j++) {
x... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 8c80f4af7488d7fce91f5cffa9ea25cb | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static ... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 908df0d41ba909890a47b519f5d1c6bf | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author alex
*/
pub... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 6a99b1ff2f28c0451f7b7fb7332aaf6e | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 8e4509779f85a24d0148f2159b7d4235 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 016077890f7294b62b8757bc4fcef238 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.util.Scanner;
/*
* M(i, j) = XOR value for elements i to j
* M(i, j) where i > j = 0;
* M(i, j) where i = j = E(i)
* M(i, j) = M(i, j - 1) ^ E(j) otherwise
*
* O(n^2)
*/
public class LittleXOR {
public static int findMax(int[] elements) {
int[][] memo = new int[elements.length][... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 95f2f4cd6c97bd63cd8211b09f96ee3d | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.util.Scanner;
public class A252A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int maxxor = 0;
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
for... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 70ea51aa04185dce45af390f2005903e | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Locale;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | ac9f88604081fdbc2b95a7538d7c0c96 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.util.Scanner;
public class R4 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] array = new int[n];
int maxor;
int xor;
for (int i = 0; i < array.length; i++) {
array[i] = ... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 485c8c2dce5ad71be45948ebabd793bf | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
public class MainProbl... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | a0a2668e3c7b2378620cf804444b98d4 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
public static StringTokenizer st;
public static BufferedReader scan;
public static PrintWriter out;
public class Pair {
public int x, y;
public Pair(int x, int y){
this.x = x;
this.y = ... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 8ebe9313ffdf84241fd7a0c8981546ef | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String args[])
{
Scanner scanner = new Scanner(System.in);
int N = scanne... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | cce18c8891c879e2b3df8e76f2664761 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class C {
public static void main(String[] args) throws Exception {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
// Scanner scan = new Scanner(System.in);
// PrintWriter... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | b103849d1680680aef67ea242e013579 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes |
import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class Solution implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 7847087743d674eddd14efc945e8abc9 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.*;
import java.util.*;
public class j
{
public static void main(String a[])throws IOException
{
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
int t=0,k=0,p=0,j=0,m=0,i=0;
long n=0,e=0;
m=Integer.parseInt(b.readLine());
int d[]=new int[m];
int f[]=new int[m];
String s;
s=b.readLin... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | dc898b83a1c76b542529c5bb8c0b3269 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
public static Scanner scan = new Scanner(System.in);
public static boolean bg = false;
public static void main(String[] args) throws Exception {
int n1 = Integer.parseInt(scan.next());
int[][] l1 = new int[n1+1][... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 0c5fc65ca403ac5475b724914ee358f6 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | //Date: Oct 14, 2013
//Time: 12:27:25 PM
import java.util.*;
import java.io.*;
public class A252 implements Runnable {
public void solve() throws IOException {
int N = nextInt();
int[] a = new int[N];
for(int i = 0; i < N; i++){
a[i] = nextInt();
}
int ans = 0;
for(int i = 0; i < N; i++){
for(... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 04813e0c00767e3e024cbaf1c8468945 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in=new InputReader(inputStream);
PrintWriter out=new PrintWriter(outputStream);
Name S... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | e9adf6f8cc8573055616dfb5a9e5c692 | train_000.jsonl | 1354807800 | Little Petya likes arrays that consist of non-negative integers a lot. Recently his mom has presented him one such array consisting of n elements. Petya immediately decided to find there a segment of consecutive elements, such that the xor of all numbers from this segment was maximal possible. Help him with that.The xo... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class LittleXor {
static int max;
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader rd = new BufferedRea... | Java | ["5\n1 2 1 1 2", "3\n1 2 7", "4\n4 2 4 8"] | 2 seconds | ["3", "7", "14"] | NoteIn the first sample one of the optimal segments is the segment that consists of the first and the second array elements, if we consider the array elements indexed starting from one.The second sample contains only one optimal segment, which contains exactly one array element (element with index three). | Java 7 | standard input | [
"implementation",
"brute force"
] | a33991c9d7fdb4a4e00c0d0e6902bee1 | The first line contains integer n (1 ≤ n ≤ 100) — the number of elements in the array. The second line contains the space-separated integers from the array. All numbers are non-negative integers strictly less than 230. | 1,100 | Print a single integer — the required maximal xor of a segment of consecutive elements. | standard output | |
PASSED | 9918468984879341df30901409afe594 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;
public class R345Div2C {
static final long MAXN=1000000000;
static class Pair{
long x,y;
String z;
public Pair(long x,long y){
this.x=x;
this.y=y;
this.z=x+"/"+y;
}
}
public... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 4f2784d8fa03741216da07043f285d15 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.Pattern;
public class Solution {
private static class Point {
int x;
int y;
Point(int x, int y) {
this.x... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | f37b7d9d46c6655938f4a304efc0ae2a | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.*;
import java.io.*;
public class CF651C{
private static InputStream stream;
private static byte[] buf = new byte[1024];
private static int curChar;
private static int numChars;
private static SpaceCharFilter filter;
private static PrintWriter pw;
private static class Point{
int x;
int y... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | e97d2776389eec061999b47eb0ace0e3 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.awt.Point;
import java.awt.geom.Line2D;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.security.GuardedObject;
im... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 8983eb9e69321f65f239bbea22ef45c3 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
/**
* Created by peacefrog on 3/3/16.
* 10:56 PM
*/
public class Task_C {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
PrintWriter out;
long timeBegin, timeEnd;
public void runIO() th... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | c4cfd33eb4b324b4b361e938688dacc9 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
public class Codef{
public static void main(String[] args) throws IOException{
BufferedReader vod=new BufferedReader(new InputStr... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | dc989e8362f93bc4afc897bb7d9dfe1d | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class C {
public static void main(String[] args) {
try {
BufferedReader br = new BufferedReader(new InputStreamReade... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 5b016778d94d70d0646a0f28cbc60a19 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.BigInteger;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Main2
{
static StringTokenizer st=new StringTokenizer("");
static BufferedReader br;
///////////////////////... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 056d633e211336d68a82952db8f89929 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.*;
public class C{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Hashtable<Long, Long> xfreq = new Hashtable<Long, Long>();
Hashtable<Long, Long> yfreq = new Hashtable<Long, Long>();
Hashtable<String, Long> seenPoints = new Hashtable... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | e401b670ad004154cf79d23e7f6c5f94 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | /**
*
*/
/**
* 2016��3��7�� ����6:39:02
* PrjName:cf345-03
* @ Semprathlon
*/
import java.io.*;
import java.util.*;
public class Main {
static Map<Integer, Integer> h=new HashMap<Integer, Integer>();
static Map<Integer, Integer> v=new HashMap<Integer, Integer>();
static Map<Long, Integer> p=new HashMap<Long, ... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | d8a01de11a36678f8445fb5031f05d36 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes |
import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
import java.math.BigDecimal;
/**
*
* @author Mojtaba
*/
public class Main {
public static void main(String[] args) throws IOException, Exception {
M... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 0e81d0cd933dcc25d65697e8cb258713 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes |
import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
import java.math.BigDecimal;
/**
*
* @author Mojtaba
*/
public class Main {
public static void main(String[] args) throws IOException, Exception {
M... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 32ccc62549c762efa421ffeb34020d00 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes |
import java.awt.Point;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
import java.math.BigDecimal;
/**
*
* @author Mojtaba
*/
public class Main {
public static void main(String[] args) throws IOException, Exception {
M... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 9d38c314ba14bca617e7533eaf6f6bab | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi, yi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.*;
import java.util.*;
public class C651 {
public static void main(String[] args) throws IOException {
input.init(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = input.nextInt();
long[] xs = new long[n], ys = new long[n];
for(int i = 0; i<n; i++)
{
xs[i] = input.nextLong();
y... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1 - 7| + |1 - 5| = 10 for Doctor Manhattan and for Daniel. For pairs (1, 1), (1, 5) and (7, 5), (1, 5) Doctor Manhattan and Daniel will calculate the same distances. | Java 7 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1 ≤ n ≤ 200 000) — the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|, |yi| ≤ 109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 93ae15778c84b579d8c22c03748422c1 | train_000.jsonl | 1422894600 | Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n × m cells, like this:Each cell contains a dot that has some color. We will use different uppercase Latin characters to express different colors.The key of this game is to find a cycle that contain dots of same c... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution{
static int n,m;
static boolean visited[][];
static boolean status=false;
public static void dfs(String[] game,int x,int y,int px,int py)
{
if(visited[x][y])
{
//System.out.println(x+" "+y);
status=tr... | Java | ["3 4\nAAAA\nABCA\nAAAA", "3 4\nAAAA\nABCA\nAADA", "4 4\nYYYR\nBYBY\nBBBY\nBBBY", "7 6\nAAAAAB\nABBBAB\nABAAAB\nABABBB\nABAAAB\nABBBAB\nAAAAAB", "2 13\nABCDEFGHIJKLM\nNOPQRSTUVWXYZ"] | 2 seconds | ["Yes", "No", "Yes", "Yes", "No"] | NoteIn first sample test all 'A' form a cycle.In second sample there is no such cycle.The third sample is displayed on the picture above ('Y' = Yellow, 'B' = Blue, 'R' = Red). | Java 11 | standard input | [
"dfs and similar"
] | 73930603e440eef854da4ba51253a5a7 | The first line contains two integers n and m (2 ≤ n, m ≤ 50): the number of rows and columns of the board. Then n lines follow, each line contains a string consisting of m characters, expressing colors of dots in each line. Each character is an uppercase Latin letter. | 1,500 | Output "Yes" if there exists a cycle, and "No" otherwise. | standard output | |
PASSED | 4e18de8494dd1236e97c40e0739c74bb | train_000.jsonl | 1422894600 | Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n × m cells, like this:Each cell contains a dot that has some color. We will use different uppercase Latin characters to express different colors.The key of this game is to find a cycle that contain dots of same c... | 256 megabytes |
import java.util.*;
public class FoxAndTwoDots {
public static boolean findCycle=false;
public static int[] dx= {1,-1,0,0};
public static int[] dy= {0,0,1,-1};
public static void dfs(int x,int y,int fromx,int fromy, char colour,int n,int m,String[] arr,boolean[][] visited) {
if(x<0 || y<0 || x>=n || y>=m) {... | Java | ["3 4\nAAAA\nABCA\nAAAA", "3 4\nAAAA\nABCA\nAADA", "4 4\nYYYR\nBYBY\nBBBY\nBBBY", "7 6\nAAAAAB\nABBBAB\nABAAAB\nABABBB\nABAAAB\nABBBAB\nAAAAAB", "2 13\nABCDEFGHIJKLM\nNOPQRSTUVWXYZ"] | 2 seconds | ["Yes", "No", "Yes", "Yes", "No"] | NoteIn first sample test all 'A' form a cycle.In second sample there is no such cycle.The third sample is displayed on the picture above ('Y' = Yellow, 'B' = Blue, 'R' = Red). | Java 11 | standard input | [
"dfs and similar"
] | 73930603e440eef854da4ba51253a5a7 | The first line contains two integers n and m (2 ≤ n, m ≤ 50): the number of rows and columns of the board. Then n lines follow, each line contains a string consisting of m characters, expressing colors of dots in each line. Each character is an uppercase Latin letter. | 1,500 | Output "Yes" if there exists a cycle, and "No" otherwise. | standard output | |
PASSED | 9b488b3a18420591fa10c43f5c95776c | train_000.jsonl | 1422894600 | Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n × m cells, like this:Each cell contains a dot that has some color. We will use different uppercase Latin characters to express different colors.The key of this game is to find a cycle that contain dots of same c... | 256 megabytes |
import java.util.*;
public class Main {
public static void union(Node A,Node B,int rank[]) {
Node x=find(A);
Node y=find(B);
if(x.val==y.val)return;
else if(rank[x.val]<rank[y.val]) {x.par=y;}
else if(rank[x.val]>rank[y.val]) {y.par=x;}
else if(rank[x.val]==rank[y.val]) {x.par=y;rank[y.val... | Java | ["3 4\nAAAA\nABCA\nAAAA", "3 4\nAAAA\nABCA\nAADA", "4 4\nYYYR\nBYBY\nBBBY\nBBBY", "7 6\nAAAAAB\nABBBAB\nABAAAB\nABABBB\nABAAAB\nABBBAB\nAAAAAB", "2 13\nABCDEFGHIJKLM\nNOPQRSTUVWXYZ"] | 2 seconds | ["Yes", "No", "Yes", "Yes", "No"] | NoteIn first sample test all 'A' form a cycle.In second sample there is no such cycle.The third sample is displayed on the picture above ('Y' = Yellow, 'B' = Blue, 'R' = Red). | Java 11 | standard input | [
"dfs and similar"
] | 73930603e440eef854da4ba51253a5a7 | The first line contains two integers n and m (2 ≤ n, m ≤ 50): the number of rows and columns of the board. Then n lines follow, each line contains a string consisting of m characters, expressing colors of dots in each line. Each character is an uppercase Latin letter. | 1,500 | Output "Yes" if there exists a cycle, and "No" otherwise. | standard output | |
PASSED | 3b8fa70a42728722bfb299a92271cc26 | train_000.jsonl | 1422894600 | Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n × m cells, like this:Each cell contains a dot that has some color. We will use different uppercase Latin characters to express different colors.The key of this game is to find a cycle that contain dots of same c... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static class Pair{
int r, c;
public Pair(int r, int c){
this.r = r;
this.c = c;
}
}
static boolean isValid(int i, int j, int n, int m, char c, char arr[][]){
return !(i < ... | Java | ["3 4\nAAAA\nABCA\nAAAA", "3 4\nAAAA\nABCA\nAADA", "4 4\nYYYR\nBYBY\nBBBY\nBBBY", "7 6\nAAAAAB\nABBBAB\nABAAAB\nABABBB\nABAAAB\nABBBAB\nAAAAAB", "2 13\nABCDEFGHIJKLM\nNOPQRSTUVWXYZ"] | 2 seconds | ["Yes", "No", "Yes", "Yes", "No"] | NoteIn first sample test all 'A' form a cycle.In second sample there is no such cycle.The third sample is displayed on the picture above ('Y' = Yellow, 'B' = Blue, 'R' = Red). | Java 11 | standard input | [
"dfs and similar"
] | 73930603e440eef854da4ba51253a5a7 | The first line contains two integers n and m (2 ≤ n, m ≤ 50): the number of rows and columns of the board. Then n lines follow, each line contains a string consisting of m characters, expressing colors of dots in each line. Each character is an uppercase Latin letter. | 1,500 | Output "Yes" if there exists a cycle, and "No" otherwise. | standard output | |
PASSED | 563853fd6ad298a8a7c40477e355fb84 | train_000.jsonl | 1422894600 | Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n × m cells, like this:Each cell contains a dot that has some color. We will use different uppercase Latin characters to express different colors.The key of this game is to find a cycle that contain dots of same c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStrea... | Java | ["3 4\nAAAA\nABCA\nAAAA", "3 4\nAAAA\nABCA\nAADA", "4 4\nYYYR\nBYBY\nBBBY\nBBBY", "7 6\nAAAAAB\nABBBAB\nABAAAB\nABABBB\nABAAAB\nABBBAB\nAAAAAB", "2 13\nABCDEFGHIJKLM\nNOPQRSTUVWXYZ"] | 2 seconds | ["Yes", "No", "Yes", "Yes", "No"] | NoteIn first sample test all 'A' form a cycle.In second sample there is no such cycle.The third sample is displayed on the picture above ('Y' = Yellow, 'B' = Blue, 'R' = Red). | Java 11 | standard input | [
"dfs and similar"
] | 73930603e440eef854da4ba51253a5a7 | The first line contains two integers n and m (2 ≤ n, m ≤ 50): the number of rows and columns of the board. Then n lines follow, each line contains a string consisting of m characters, expressing colors of dots in each line. Each character is an uppercase Latin letter. | 1,500 | Output "Yes" if there exists a cycle, and "No" otherwise. | standard output | |
PASSED | ff0adae3f5a1c41cc864d4a516d92043 | train_000.jsonl | 1422894600 | Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n × m cells, like this:Each cell contains a dot that has some color. We will use different uppercase Latin characters to express different colors.The key of this game is to find a cycle that contain dots of same c... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
public class ladders510b {
static BufferedReader __in;
static PrintWriter __out;
static StringTokenizer input;
static char[][] b;
static Set<P> visited = new HashSet<>();
static int n, m, d... | Java | ["3 4\nAAAA\nABCA\nAAAA", "3 4\nAAAA\nABCA\nAADA", "4 4\nYYYR\nBYBY\nBBBY\nBBBY", "7 6\nAAAAAB\nABBBAB\nABAAAB\nABABBB\nABAAAB\nABBBAB\nAAAAAB", "2 13\nABCDEFGHIJKLM\nNOPQRSTUVWXYZ"] | 2 seconds | ["Yes", "No", "Yes", "Yes", "No"] | NoteIn first sample test all 'A' form a cycle.In second sample there is no such cycle.The third sample is displayed on the picture above ('Y' = Yellow, 'B' = Blue, 'R' = Red). | Java 11 | standard input | [
"dfs and similar"
] | 73930603e440eef854da4ba51253a5a7 | The first line contains two integers n and m (2 ≤ n, m ≤ 50): the number of rows and columns of the board. Then n lines follow, each line contains a string consisting of m characters, expressing colors of dots in each line. Each character is an uppercase Latin letter. | 1,500 | Output "Yes" if there exists a cycle, and "No" otherwise. | standard output | |
PASSED | edcc6f960b274af24cac5c53d596671c | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main
{
static InputReader in;
static OutputWriter out;
static final boolean OJ = System.getProperty("ONLINE_JUDGE") != null;
public static void main(String[] args) throws IOException
{
in = new InputReader(OJ ? System.in : new FileInputStr... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 6de6cbb48480ada7207da60d81d24b5a | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main
{
static InputReader in;
static OutputWriter out;
static final boolean OJ = System.getProperty("ONLINE_JUDGE") != null;
public static void main(String[] args) throws IOException
{
in = new InputReader(OJ ? System.in : new FileInputStr... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 4c68bbe0dcc0433b5919e2c9e6dd0d97 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.*;
import java.util.*;
public class PrimeMatrix{
static int primeCount = 0;
static int prime[] = new int[100000];
public static void main(String args[]) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.read... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | a5e55f15a0d7efd210b056618a6ca8e3 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
public class B {
static int len = 100005;
static boolean[] isprime = new boolean[len];
static int[] primes;
static void seive() {
int i, j, index;
index = 0;
for (i = 0; i < len; i++) {
isp... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 7956361bf377537ee4be7890d313571a | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.Scanner;
import java.util.ArrayList;
public class PrimeMatrix
{
public static int TimesOfIncrese(ArrayList<Integer> primes, int num)
{
int low = 0;
int high = primes.size() - 1;
int mid;
int temp;
while (low <= high)
{
mid = (low + high) / 2;
temp = primes.get(mid);
if (temp == ... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | ce97b9a79ef54f605869048a5b355ba3 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.*;
public class B271 {
public static void main(String[] args){
Scanner br = new Scanner(System.in);
int max = 2000000;
boolean[] isPrime = new boolean[max];
Arrays.fill(isPrime, true);
TreeSet<Integer> ps = new TreeSet<Integer>();
for(int i = 2;i<max;i++){
if(isPrime[i]){
ps.add(i);... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | c90c7fcd81224e6207deba9c09a07d38 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class TC
{
static ArrayList<Integer> prime;
static int list[];
static int[][] arr;
static int N,M;
static ... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 510c69333cd4fa8f34f1902f6108d47a | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class Main
{
public static void main(String args[]) throws IOException
{
BufferedReader c=new BufferedReader(new InputStreamReader(System.in));
String S[]=c.readLine().split(" ");
int N=Integer.parseInt(S[0]);
int M=Integer.parseInt(S[1]);
... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 2a9e1b3490ab30dcbe8a8d3c0d4d5abe | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
public class ProblemB {
static final ... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | a52d1698b5985816805546e19e09fc52 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | //package round166;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class B {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int[] primes = siev... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 5bf24177c55e1e7e825f813422b519b6 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.min;
import static java.lang.Math.max;
public class Code implements Runnable {
public static void main(String[] args) throws IOException {
new Thread(new Code()).start();
}
private void solve() throws IOException {
int n =... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 6d4dd4633432a16c329d55deed799117 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.DataInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.TreeSet;
public class Main{
public static void main(String[] args) throws Exception {
Parserdoubt s = new Parserdoubt(System.in);
ArrayList<Int... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 31b308a7eea26527d96a78971c4f7cac | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static int[] nextPrimeDP;
static boolean isPrime(int x) {
if(x == 1) return false;
if(x == 2) return true;
if(x % 2 == 0) return false;
int sqrtx = (int) Math.sqrt(x);
for(int i = 3; i <= sqrtx; i += 2) {
... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | b929a845b742b369c4a42da2e95a1f80 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.Iterator;
impo... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | be19eecf205db8bc1d9df9b6ee73e895 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.*;
import java.io.*;
public class B {
public void solve() throws IOException {
boolean[] sieve = new boolean[101000];
sieve[0] = true;
sieve[1] = true;
for(int i = 2; i*i < sieve.length; i++){
if( !sieve[i] ){
for(int j = i*i; j < sieve.length; j+=i){
sieve[j] = true;
}
}
... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 7eb9341984b412c7f3b210e36e182aea | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class B
{
String line;
StringTokenizer inputParser;
BufferedReader is;
FileInputStream fstream;
DataInputStream in;
String FInput="";
void openInput(String file)
{
... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 32d81f76d4028c809d46dcfc4a8c7962 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.*;
public class Main{
public static int [] PrimeTable = new int[ 100000];
public static int Count = 0;
public static boolean isprime(int a){
if (a%2 == 0)return true;
for (int i=3;i<=Math.sqrt(a) ; i+=2){
if(a % i == 0 ) r... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 0da17e6669d9944a78be130051d7ed68 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.util.Scanner;
public class B {
boolean primes[] = new boolean[100091];
public void generate(int n){
primes[0] = true;
primes[1] = true;
for(int i = 2 ; i <= (int)Math.sqrt(n) ; i++){
for(int j=i+1 ; j<=n ; j++){
if( !primes[j] && j%i==0 ) primes[j] = true;
}
}
... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | ee2e3231dbc1eeb479feb52c85f7dd96 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
/**
*
* @author user
*/
public class Prime_Matrix {
static boolean prime[]; static int n1=0;//f[]=new int[... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | b8ac2824430a7e8e640f29c49c58af08 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.*;
import java.util.*;
public class second
{
static long fast_power(long a,long n,long m)
{
if(n==1)
{
return a%m;
}
if(n%2==1)
{
long power = fast_power(a,(n-1)/2,m)%m;
return ((a%m) * ((power*power)%m))%m;
}
long power = fast_power(a,n/2,m)%m;
return (power*power)%m;
... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | f6d423fff7b94e2eccaf80c2f0a6a416 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
public class B {
public static int MAX = 200000;
public static void main(String[] args) throws IOException{
Scanner sc = new Scanner... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output | |
PASSED | 750d3eb6c411cd028a9d2f57ef594f64 | train_000.jsonl | 1360596600 | You've got an n × m matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be increased an arbitrary number of times.You are really curious about prime numbers. Let us remind you that a p... | 256 megabytes | /**
* @author Juan Sebastian Beltran Rojas
* @mail jsbeltran.valhalla@gmail.com
* @veredict No enviado
* @problemId CF166B.java
* @problemName CF166B.java
* @judge http://www.spoj.pl | http://uva.onlinejudge.org/ | http://livearchive.onlinejudge.org/
* @category ---
* @level ???
* @date 11/02/2013
**/
import ... | Java | ["3 3\n1 2 3\n5 6 1\n4 4 1", "2 3\n4 8 8\n9 2 9", "2 2\n1 3\n4 2"] | 2 seconds | ["1", "3", "0"] | NoteIn the first sample you need to increase number 1 in cell (1, 1). Thus, the first row will consist of prime numbers: 2, 2, 3.In the second sample you need to increase number 8 in cell (1, 2) three times. Thus, the second column will consist of prime numbers: 11, 2.In the third sample you don't have to do anything a... | Java 6 | standard input | [
"binary search",
"number theory",
"brute force",
"math"
] | d549f70d028a884f0313743c09c685f1 | The first line contains two integers n, m (1 ≤ n, m ≤ 500) — the number of rows and columns in the matrix, correspondingly. Each of the following n lines contains m integers — the initial matrix. All matrix elements are positive integers. All numbers in the initial matrix do not exceed 105. The numbers in the lines are... | 1,300 | Print a single integer — the minimum number of moves needed to get a prime matrix from the one you've got. If you've got a prime matrix, print 0. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.