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 | 3f9a3bc70cfa8c80915e6369eda8d71b | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
import java.text.DecimalFormat;
import java.util.*;
public class Main {
private static final int MAX = 1000*1000,MAXP2 = 1 << 19,MAXST = MAXP2 << 1;
private static int n,m;
private static int [] A;
private static int [] sig0;
... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | bae91be03f0c3b147e7610411d743057 | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main3 {
static int[] D;
static void fill()
{
int n = 1+(int)1e6;
D = new int[n]... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 227c2ac0e1935b22e9a6f15c0d640a1c | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | /*Author: Satyajeet Singh, Delhi Technological University*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;
import java.math.*;
public class Main{
/*********************************************Constants******************************************/
static PrintWrite... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 9c4266b631bf10b023cc21b4eb0fb6dd | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.TreeSet;
/*
public class _920F {
}
*/
public class _920F {
public class SegmentTree {
long[] st;
... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 9e7d9fb4850d6db32f49303137f6eda2 | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
static final long MOD = (long)1e9+7;
static final int MAX = (int)1e6+1;
static FastReader in;
static int[] count,A;
static long[] sum,max;
public static void main(String[] args){
in = new FastReader();
... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 227b61278c2ccd6a6ae04820384793f5 | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
static final long MOD = (long)1e9+7;
static final int MAX = (int)1e6+1;
static FastReader in;
static int[] count,A;
static long[] sum,max;
public static void main(String[] args){
in = new FastReader();
... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 80d46356d5511c1bca638a2ccf7b053f | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int n... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 4f2453838b998f7331b9c794a616153a | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | //package educational.round37;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;
public class F {
InputStream is;
PrintWriter out... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 2e2d843afdf669b97924b42ae85ae720 | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | import java.io.*;
import java.util.*;
public class F {
public static void main(String[] args) {new F();}
F () {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
System.err.println("Go!");
int max = (int)1e6+1;
int[] div = new int[max];
for(int i = 1; i < max; i++)
... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 2db100e320e761198514a8ca5bf5fe60 | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | /*
ЗАПУСКАЕМ ВЫСОКОГО
░ГУСЯ░▄▀▀▀▄░РАБОТЯГИ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 71d3748f079b4fc1406a5e70f0d6af48 | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | /*
ЗАПУСКАЕМ ВЫСОКОГО
░ГУСЯ░▄▀▀▀▄░РАБОТЯГИ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | f2685c36cb59b0b9e81146bbbe685423 | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | /*
ЗАПУСКАЕМ ВЫСОКОГО
░ГУСЯ░▄▀▀▀▄░РАБОТЯГИ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 609d5710ca296a2eec7b7229e6019f8d | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | /*
ЗАПУСКАЕМ ВЫСОКОГО
░ГУСЯ░▄▀▀▀▄░РАБОТЯГИ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 2c3d367e5277e630fc282043933c584a | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes |
import java.util.*;
import java.io.*;
public class Main {
long[]lo,hi,sum,max,D;
public Main(int arr[]){
int n=arr.length;
lo=new long[4*n+1];
hi=new long[4*n+1];
max=new long[4*n+1];
sum=new long[4*n+1];
D=new long[1000002];
D();
init(1,0,n-1,a... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | f015ef3ce396509bd6b5212f9f7aadc0 | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes |
import java.io.*;
import java.util.Random;
import java.util.StringTokenizer;
public class Main {
static class Solution extends Helper {
static int[] memo;
static int d(int n) {
return memo[n];
}
public void solve(InputReader in, PrintWriter out) {
memo = ... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 87feaa9eeab694e0b7de4ebb007ff6d0 | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class Test {
static InputReader in;
static PrintWriter out;
static int[] divisors;
public static void main(String[] args) {
in = new InputReader();
out = new PrintWriter(System.out);
int size = (int)1e6;
divisors... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | ac986e7d9a7931bcb6cc2874487d2e37 | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes |
import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
import java.text.DecimalFormat;
import java.util.*;
public class Main {
private static final int MAX = 1000*1000,MAXP2 = 1 << 19,MAXST = MAXP2 << 1;
private static int n,m;
private static int [] A;
private static int [] sig0;
... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | 591a8b5ca96b85193ce00d7c7e92f986 | train_000.jsonl | 1517582100 | Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author khokharnikunj8
*/
public ... | Java | ["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"] | 2 seconds | ["30\n13\n4\n22"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"number theory",
"brute force"
] | 078cdef32cb5e60dc66c66cae3d4a57a | The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-... | 2,000 | For each SUM query print the answer to it. | standard output | |
PASSED | cc42b8c2ec01d93d69bfe05cb0bbad8a | train_000.jsonl | 1277391600 | Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is located in the bottom-left corner, Ox axis is directed right, Oy axis is directed up. Pete gives Bob requests of three types: add x y — on the sheet of paper Bob marks a... | 256 megabytes | import java.util.List;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeMap;
import java.util.ArrayList;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;
import java.math.BigInteger;
... | Java | ["7\nadd 1 1\nadd 3 4\nfind 0 0\nremove 1 1\nfind 0 0\nadd 1 1\nfind 0 0", "13\nadd 5 5\nadd 5 6\nadd 5 7\nadd 6 5\nadd 6 6\nadd 6 7\nadd 7 5\nadd 7 6\nadd 7 7\nfind 6 6\nremove 7 7\nfind 6 6\nfind 4 4"] | 2 seconds | ["1 1\n3 4\n1 1", "7 7\n-1\n5 5"] | null | Java 8 | standard input | [
"data structures"
] | da1206100811e4a51b9453babfa2c821 | The first input line contains number n (1 ≤ n ≤ 2·105) — amount of requests. Then there follow n lines — descriptions of the requests. add x y describes the request to add a point, remove x y — the request to erase a point, find x y — the request to find the bottom-left point. All the coordinates in the input file are ... | 2,800 | For each request of type find x y output in a separate line the answer to it — coordinates of the bottommost among the leftmost marked points, lying strictly above and to the right of point (x, y). If there are no points strictly above and to the right of point (x, y), output -1. | standard output | |
PASSED | 1585a32d365958776c10c9b0043f0e55 | train_000.jsonl | 1277391600 | Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is located in the bottom-left corner, Ox axis is directed right, Oy axis is directed up. Pete gives Bob requests of three types: add x y — on the sheet of paper Bob marks a... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;
public class Main implements Runnable {
static final int MOD = (int) 1e9 + 7;
static final int MI = (int) 1e9;
static final long ML = (long) 1e18;
static final Reader in = new Reader();
static f... | Java | ["7\nadd 1 1\nadd 3 4\nfind 0 0\nremove 1 1\nfind 0 0\nadd 1 1\nfind 0 0", "13\nadd 5 5\nadd 5 6\nadd 5 7\nadd 6 5\nadd 6 6\nadd 6 7\nadd 7 5\nadd 7 6\nadd 7 7\nfind 6 6\nremove 7 7\nfind 6 6\nfind 4 4"] | 2 seconds | ["1 1\n3 4\n1 1", "7 7\n-1\n5 5"] | null | Java 8 | standard input | [
"data structures"
] | da1206100811e4a51b9453babfa2c821 | The first input line contains number n (1 ≤ n ≤ 2·105) — amount of requests. Then there follow n lines — descriptions of the requests. add x y describes the request to add a point, remove x y — the request to erase a point, find x y — the request to find the bottom-left point. All the coordinates in the input file are ... | 2,800 | For each request of type find x y output in a separate line the answer to it — coordinates of the bottommost among the leftmost marked points, lying strictly above and to the right of point (x, y). If there are no points strictly above and to the right of point (x, y), output -1. | standard output | |
PASSED | f92fc1c52094f0dd6f8c4e267d0e4068 | train_000.jsonl | 1277391600 | Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is located in the bottom-left corner, Ox axis is directed right, Oy axis is directed up. Pete gives Bob requests of three types: add x y — on the sheet of paper Bob marks a... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;
public class Main implements Runnable {
static final int MOD = (int) 1e9 + 7;
static final int MI = (int) 1e9;
static final long ML = (long) 1e18;
static final Reader in = new Reader();
static f... | Java | ["7\nadd 1 1\nadd 3 4\nfind 0 0\nremove 1 1\nfind 0 0\nadd 1 1\nfind 0 0", "13\nadd 5 5\nadd 5 6\nadd 5 7\nadd 6 5\nadd 6 6\nadd 6 7\nadd 7 5\nadd 7 6\nadd 7 7\nfind 6 6\nremove 7 7\nfind 6 6\nfind 4 4"] | 2 seconds | ["1 1\n3 4\n1 1", "7 7\n-1\n5 5"] | null | Java 8 | standard input | [
"data structures"
] | da1206100811e4a51b9453babfa2c821 | The first input line contains number n (1 ≤ n ≤ 2·105) — amount of requests. Then there follow n lines — descriptions of the requests. add x y describes the request to add a point, remove x y — the request to erase a point, find x y — the request to find the bottom-left point. All the coordinates in the input file are ... | 2,800 | For each request of type find x y output in a separate line the answer to it — coordinates of the bottommost among the leftmost marked points, lying strictly above and to the right of point (x, y). If there are no points strictly above and to the right of point (x, y), output -1. | standard output | |
PASSED | 212bb9988a94ba93e47a8161d5c749ff | train_000.jsonl | 1277391600 | Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is located in the bottom-left corner, Ox axis is directed right, Oy axis is directed up. Pete gives Bob requests of three types: add x y — on the sheet of paper Bob marks a... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NavigableSet;
i... | Java | ["7\nadd 1 1\nadd 3 4\nfind 0 0\nremove 1 1\nfind 0 0\nadd 1 1\nfind 0 0", "13\nadd 5 5\nadd 5 6\nadd 5 7\nadd 6 5\nadd 6 6\nadd 6 7\nadd 7 5\nadd 7 6\nadd 7 7\nfind 6 6\nremove 7 7\nfind 6 6\nfind 4 4"] | 2 seconds | ["1 1\n3 4\n1 1", "7 7\n-1\n5 5"] | null | Java 8 | standard input | [
"data structures"
] | da1206100811e4a51b9453babfa2c821 | The first input line contains number n (1 ≤ n ≤ 2·105) — amount of requests. Then there follow n lines — descriptions of the requests. add x y describes the request to add a point, remove x y — the request to erase a point, find x y — the request to find the bottom-left point. All the coordinates in the input file are ... | 2,800 | For each request of type find x y output in a separate line the answer to it — coordinates of the bottommost among the leftmost marked points, lying strictly above and to the right of point (x, y). If there are no points strictly above and to the right of point (x, y), output -1. | standard output | |
PASSED | ca971c1d968600b62ba2dc5316064449 | train_000.jsonl | 1277391600 | Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is located in the bottom-left corner, Ox axis is directed right, Oy axis is directed up. Pete gives Bob requests of three types: add x y — on the sheet of paper Bob marks a... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NavigableSet;
i... | Java | ["7\nadd 1 1\nadd 3 4\nfind 0 0\nremove 1 1\nfind 0 0\nadd 1 1\nfind 0 0", "13\nadd 5 5\nadd 5 6\nadd 5 7\nadd 6 5\nadd 6 6\nadd 6 7\nadd 7 5\nadd 7 6\nadd 7 7\nfind 6 6\nremove 7 7\nfind 6 6\nfind 4 4"] | 2 seconds | ["1 1\n3 4\n1 1", "7 7\n-1\n5 5"] | null | Java 8 | standard input | [
"data structures"
] | da1206100811e4a51b9453babfa2c821 | The first input line contains number n (1 ≤ n ≤ 2·105) — amount of requests. Then there follow n lines — descriptions of the requests. add x y describes the request to add a point, remove x y — the request to erase a point, find x y — the request to find the bottom-left point. All the coordinates in the input file are ... | 2,800 | For each request of type find x y output in a separate line the answer to it — coordinates of the bottommost among the leftmost marked points, lying strictly above and to the right of point (x, y). If there are no points strictly above and to the right of point (x, y), output -1. | standard output | |
PASSED | f2a177e60a23e32e8cf78625ccb4e2fd | train_000.jsonl | 1277391600 | Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is located in the bottom-left corner, Ox axis is directed right, Oy axis is directed up. Pete gives Bob requests of three types: add x y — on the sheet of paper Bob marks a... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NavigableSet;
i... | Java | ["7\nadd 1 1\nadd 3 4\nfind 0 0\nremove 1 1\nfind 0 0\nadd 1 1\nfind 0 0", "13\nadd 5 5\nadd 5 6\nadd 5 7\nadd 6 5\nadd 6 6\nadd 6 7\nadd 7 5\nadd 7 6\nadd 7 7\nfind 6 6\nremove 7 7\nfind 6 6\nfind 4 4"] | 2 seconds | ["1 1\n3 4\n1 1", "7 7\n-1\n5 5"] | null | Java 8 | standard input | [
"data structures"
] | da1206100811e4a51b9453babfa2c821 | The first input line contains number n (1 ≤ n ≤ 2·105) — amount of requests. Then there follow n lines — descriptions of the requests. add x y describes the request to add a point, remove x y — the request to erase a point, find x y — the request to find the bottom-left point. All the coordinates in the input file are ... | 2,800 | For each request of type find x y output in a separate line the answer to it — coordinates of the bottommost among the leftmost marked points, lying strictly above and to the right of point (x, y). If there are no points strictly above and to the right of point (x, y), output -1. | standard output | |
PASSED | 1c87df9efcd8a386bf922d18911434bc | train_000.jsonl | 1277391600 | Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is located in the bottom-left corner, Ox axis is directed right, Oy axis is directed up. Pete gives Bob requests of three types: add x y — on the sheet of paper Bob marks a... | 256 megabytes |
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.io.IOException;
import java.io.BufferedReader;
i... | Java | ["7\nadd 1 1\nadd 3 4\nfind 0 0\nremove 1 1\nfind 0 0\nadd 1 1\nfind 0 0", "13\nadd 5 5\nadd 5 6\nadd 5 7\nadd 6 5\nadd 6 6\nadd 6 7\nadd 7 5\nadd 7 6\nadd 7 7\nfind 6 6\nremove 7 7\nfind 6 6\nfind 4 4"] | 2 seconds | ["1 1\n3 4\n1 1", "7 7\n-1\n5 5"] | null | Java 8 | standard input | [
"data structures"
] | da1206100811e4a51b9453babfa2c821 | The first input line contains number n (1 ≤ n ≤ 2·105) — amount of requests. Then there follow n lines — descriptions of the requests. add x y describes the request to add a point, remove x y — the request to erase a point, find x y — the request to find the bottom-left point. All the coordinates in the input file are ... | 2,800 | For each request of type find x y output in a separate line the answer to it — coordinates of the bottommost among the leftmost marked points, lying strictly above and to the right of point (x, y). If there are no points strictly above and to the right of point (x, y), output -1. | standard output | |
PASSED | e3c9dfbd8d844dafc5f2546521166e76 | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 256 megabytes | import java.util.Scanner;
public class code964C {
static long m = 1000000009;
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
int n = s.nextInt();
long a = s.nextLong();
long b = s.nextLong();
int k = s.nextInt();
s.nextLine();
char[] cc = s.nextLine().toCharArray();
... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | 464902d212fe8164477a15a477682cb1 | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 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 Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int n=scan.nextInt();
int a=scan.... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | 033ab1fb52ecb683556cfeade3a403ac | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 256 megabytes | //Codeforces Round #475 (Div. 2)
import java.io.*;
import java.util.*;
public class TaskC {
public static long P = 1000000009;
/*
def egcd(a, b):
x,y, u,v = 0,1, 1,0
while a != 0:
q, r = b//a, b%a
m, n = x-u*q, y-v*q
b,a, x,y, u,v = a,r, u,v, m,n
gcd = b
return gcd, x, y
p... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | 045616076b38fedeb1ba04bf2d8126d4 | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 256 megabytes | import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static Scanner sc=new Scanner(System.in);
public static long mod=1000000000+9;
public static boolean flag[];
public static void main(String[] ar... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | 58cc71d8928992f96a72a7285035280f | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 256 megabytes | import java.util.*;
import java.io.*;
public class ProbC implements Runnable{
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;
static long MOD = (long)1... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | 8f5138d0d890a8e9e0291aed0ccb0ed9 | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
void solve(){
long n=ni(),a=ni(),b=ni();
int k=ni();
char s[]=ns().toCharArray();
long p=(n+1)/k-1;
long ans=0;
for(int i=0;i<s.length;i++){
int d=-1;
if(s[i]=='+') d=1;
lon... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | 736e50585824b39e0cfe80dda9c3cb65 | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 256 megabytes | import java.io.*;
import java.util.*;
/*
* Heart beats fast
* Colors and promises
* How to be brave
* How can I love when I am afraid to fall...
*/
public class Main
{
public static void main(String[] args)
{
int n=ni(),b=ni(),a=ni(),k=ni();
long mod=1000000009;
String s=ns();
int ho[]=new int... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | 4f648675e280e819b373a2ebb0206d5c | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 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);
Task... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | df77565a7b076c0466fbc079eff926bf | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 256 megabytes | /*
[ ( ^ _ ^ ) ]
*/
import java.io.*;
import java.util.*;
public class test {
int INF = (int)1e9;
long MOD = 1000000009;
long pow(long a, long n) {
if (n == 0) {
return 1;
}
long rs = 1;
while (n > 0) {
if (n % 2 == 1) {
rs *= a;... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | 379c79b26f32143fb0fabad5acd22b96 | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class AlternatingSum {
int MOD = (int) 1e9 + 9;
void solve() {
int n = in.nextInt(), a = in.nextInt(), b ... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | 290ee108c3ba813ef1d40f0c222dca13 | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Darshandarji
*/
public cla... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | 7df6319a1d5f130586da5bd46ec459cd | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.min ; import static java.lang.Math.max ;
import static java.lang.Math.abs ; import static java.lang.Math.log ;
import static java.lang.Math.pow ; import static java.lang.Math.sqrt ;
/**
* Actual solution is at the top
* This was n... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | 33d33ab312e0b2c4e1bc227acd5b12a0 | train_000.jsonl | 1523973900 | You are given two integers $$$a$$$ and $$$b$$$. Moreover, you are given a sequence $$$s_0, s_1, \dots, s_{n}$$$. All values in $$$s$$$ are integers $$$1$$$ or $$$-1$$$. It's known that sequence is $$$k$$$-periodic and $$$k$$$ divides $$$n+1$$$. In other words, for each $$$k \leq i \leq n$$$ it's satisfied that $$$s_{i}... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;
public class C {
/*
16 2 3 3
+-+
4 5 3 1
+
*/
static long N, X, Y;
static int K;
static int ar[];
static long mod = 1000000009;
public... | Java | ["2 2 3 3\n+-+", "4 1 5 1\n-"] | 1 second | ["7", "999999228"] | NoteIn the first example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i})$$$ = $$$2^{2} 3^{0} - 2^{1} 3^{1} + 2^{0} 3^{2}$$$ = 7In the second example:$$$(\sum \limits_{i=0}^{n} s_{i} a^{n - i} b^{i}) = -1^{4} 5^{0} - 1^{3} 5^{1} - 1^{2} 5^{2} - 1^{1} 5^{3} - 1^{0} 5^{4} = -781 \equiv 999999228 \pmod{10^{9} + 9}$$$. | Java 8 | standard input | [
"number theory",
"math",
"matrices"
] | 607e670403a40e4fddf389caba79607e | The first line contains four integers $$$n, a, b$$$ and $$$k$$$ $$$(1 \leq n \leq 10^{9}, 1 \leq a, b \leq 10^{9}, 1 \leq k \leq 10^{5})$$$. The second line contains a sequence of length $$$k$$$ consisting of characters '+' and '-'. If the $$$i$$$-th character (0-indexed) is '+', then $$$s_{i} = 1$$$, otherwise $$$s_{... | 1,800 | Output a single integer — value of given expression modulo $$$10^{9} + 9$$$. | standard output | |
PASSED | a78d2321f15d22a23a648ecd79532624 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.IOException;
import java.io.Reader;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-i... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 83deacec302d8fbddf0263a5c0e7b192 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Rene
*/
public class Main {
public static void main(String[] ar... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 4cd1d2c20e33c132835216d9bd26d180 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes |
import java.util.*;
import java.io.*;
public class CF_A {
static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st;
static void newST() throws IOException {st = new StringTokenizer(in.readLine());}
static int stInt() {return Integer.parseInt(st.nextToken());}
sta... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 0e48a0daa5051c462e2280f5d55fa582 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 6d5f46a2542afd1c81cb97a6c5cf9785 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 1f46e2663c55567f23c3ca7017ab4e18 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main {
FastScanner in;
PrintWriter out;
static final String FILE = "";
public void solve() {
int n = in.nextInt();
int ms[] = new int[n];
int cnt[] = new int[n];
int ans[] = new int[n]... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | ef1a156c982ab8533e52a7ea88aa3e69 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class ProblemA4 {
BufferedReader rd;
ProblemA4() throws IOException {
rd = new BufferedReader(new InputStreamReader(System.in));
compute();
}
private void compute() throws IOException {... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 6ce68b4deb071717e51b6e36485bf43e | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class A {
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 InputStreamReader(new FileInputStream... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 5b52543b55e018f83f84ef041923b951 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | // practice with rainboy
import java.io.*;
import java.util.*;
public class CF674A extends PrintWriter {
CF674A() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF674A o = new CF674A(); o.main(); o.flush();
}
void main() {
int n = sc.nextInt();
int[]... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | bd3db78e8ce854eee558a4dbe4c2cb07 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
import static java.util.Arrays.fill;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStrea... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | f67560c28c367c6aca02c78058f5b369 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.util.*;
public class BearAndColors
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] array = new int[n];
for(int x = 0; x < n; x++)
{
array[x] = in.nextInt() - 1;
}
int[] result = new int[n];
for(int y = 0; y < array.len... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 4c931e783e35619f64fae65c71e5b9bc | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
/**
*
* @author nayrouz
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Write your awsome code here :D
S... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 36b9cdfb33fd002e0a00fc9c8404a73e | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class A {
InputStream is;
int __t__ = 1;
int __f__ = 0;
int __FILE_DEBUG_FLAG__ = __f__;
String __DEBUG_FILE_NAME__ = "src/T";
FastScanner in;
PrintWriter out;
public void solve() {
int n = in.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 855bc273d8de478bdf1fb5e262133545 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Bit... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 32db4fd70f5525dc5e15437565523aca | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | // package codeforces.cf3xx.cf351.div1;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
/**
* Created by hama_du on 2016/08/16.
*/
public class A {
public static void main(String[] args) {
InputReader i... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 169fdb3d4bd9e5d9f9ff22f2b222000e | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 8333b33c558446eb44ff2d7979e56002 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | //package vk2016.r3;
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 A {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ni();
in... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 0bb1050b25b5e9996d0f4ee7695c10cf | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution {
private BufferedReader in;
private StringTokenizer line;
private PrintWriter out;
private static final int mm = 1000000007;
public void solve() throws IOException {
int n = nextInt();
int[] a = nextIntArray(n);
... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 3ec2b76bf3dfc8aa6c0803a39119f249 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
private NotMyScanner in;
private PrintWriter out;
// private Timer timer = new Timer();
// Или пиши красиво, или не пиши вообще.
private void solve() throws IOException {
int n = in.nextInt(),... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 6628a431d0cf536740bd34f463dbbba0 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | /**
* Created by ankeet on 1/9/17.
*/
import java.io.*;
import java.util.*;
public class A674 {
static FastReader in = null;
static PrintWriter out = null;
public static void solve()
{
int n = in.nextInt();
int[] t = new int[n+5];
for(int i=1; i<=n; i++) t[i] = in.nextInt();... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 32bc89c7033f0aefceb82188ba91d7e3 | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.awt.Point;
import java.math.BigDecimal;
import java.math.BigInteger;
import static java.lang.Math.*;
public class A implements Runnable{
final static Random rnd = new Random();
// SOLUTION!!!
// HACK ME PLEASE IF YOU CAN!!!
// PLEASE!!!
// PLEASE!!!
// PLE... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 2eb4695f377662990892f2eba1a9346c | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Igor Kraskevich
*/
public c... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 782e364b749db933e5dafdaf0ff43e4e | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static class Reader
{
private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
public int read() {if (nu... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | c192bd330f27810ed18dc2ac6bdb2caa | train_000.jsonl | 1462633500 | Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurring the biggest ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class B {
public static void main(String[] args) throws NumberFormatException, IOException
{
Scanner sc = new Scanner(Sys... | Java | ["4\n1 2 1 2", "3\n1 1 1"] | 2 seconds | ["7 3 0 0", "6 0 0"] | NoteIn the first sample, color 2 is dominant in three intervals: An interval [2, 2] contains one ball. This ball's color is 2 so it's clearly a dominant color. An interval [4, 4] contains one ball, with color 2 again. An interval [2, 4] contains two balls of color 2 and one ball of color 1. There are 7 more interval... | Java 8 | standard input | [
"data structures",
"implementation",
"brute force"
] | f292c099e4eac9259a5bc9e42ff6d1b5 | The first line of the input contains a single integer n (1 ≤ n ≤ 5000) — the number of balls. The second line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ n) where ti is the color of the i-th ball. | 1,500 | Print n integers. The i-th of them should be equal to the number of intervals where i is a dominant color. | standard output | |
PASSED | 60f68c7aba75d9b723ef5d8566aae6b3 | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes |
import java.util.HashSet;
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Andy Phan
*/
public class p1161b {
public static void mai... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | cc1869fd5a85024f648c59818c578fc7 | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.AbstractList;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Coll... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | 53de0c47044d5c0f385aac28501aab0f | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | //package que_b;
import java.io.*;
import java.util.*;
import java.math.*;
public class utkarsh {
InputStream is;
PrintWriter out;
long mod = (long)(1e9 + 7), inf = (long)(3e18);
int[] z_Algo(ArrayList <Integer> d) {
int n = d.size();
int z[] = new int[n];
int l = 0,... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | 37d8e43171f94ea16f089958da24a078 | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class B {
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 InputStreamReader(new FileInputStream... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | aa24a2ecfe3fa12948f3def3fb9fe7a3 | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes |
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.*;
public class CFCT1161 {
public static void main(String[] args) throws Exception {
boolean local = System.getProperty("ONLINE_JUDGE") ==... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | f8484e78709aa005f1eff05df26fb0c0 | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.io.UncheckedIOException;
import java.nio.charset.Charset;
import java.util.... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | 4a939e8299f38c80757195da06eb917c | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.io.*;
import java.util.*;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStrea... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | ced346ce7c0ed5aa76989fe75053a0df | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
//http://codeforces.com/contest/1161/problem/B
public class ChladniFigure {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamRead... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | 666a6343e29bd3a5db6c338cc84c0040 | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.io.IOException;
import java.util.InputMismatchException;
import java.util.Random;
import java.io.InputStreamReader;... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | cf6078b5679b52c1342e2260e1c646a6 | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.io.*;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
public class SolverB {
StringTokenizer stok;
BufferedReader br;
PrintWriter pw;
String nextToken() throws IOException {
while (stok == null || !stok.hasMoreTokens()) {
stok = new St... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | 5969c9896814cffe3b05bc184581bf1e | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | 88e835d52940af3d37eb7bb5e0c7d39e | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.util.Set;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | 420277740bb5b8a435f4b7a90f642313 | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
//SOLUTION BEGIN
//This code is not meant for understanding, proceed with caution
int[] spf;
void pre() throws Exception{
spf= new int[MX];
for(int i = 2; i< MX; i++)
if(spf[i]==0)
f... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | 223d0507718caaa9137f8f35fa57319f | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.util.*;
import java.io.*;
public class TaskB implements Runnable {
public static void main(String[] args) {
new Thread(new TaskB()).start();
}
@Override
public void run() {
br = new BufferedReader(new InputStreamReader(System.in));
out = new PrintWriter(System.out);... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | 548e9b3983955d604e8c0e755ebb43b7 | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
import static java.lang.Math.*;
/* spar5h */
public class cf2 implements Runnable {
public void run() {
InputReader s = new InputReader(System.in);
PrintWriter w = new PrintWriter(System.out);
int n = s.nextInt(), m = s.nextInt();
... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | 4a32615caaca01352d6382aeb7c4a22d | train_000.jsonl | 1556989500 | Inaka has a disc, the circumference of which is $$$n$$$ units. The circumference is equally divided by $$$n$$$ points numbered clockwise from $$$1$$$ to $$$n$$$, such that points $$$i$$$ and $$$i + 1$$$ ($$$1 \leq i < n$$$) are adjacent, and so are points $$$n$$$ and $$$1$$$.There are $$$m$$$ straight segments on th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Set;
import java.io.IOException;
import java.util.Random;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.i... | Java | ["12 6\n1 3\n3 7\n5 7\n7 11\n9 11\n11 3", "9 6\n4 5\n5 6\n7 8\n8 9\n1 2\n2 3", "10 3\n1 2\n3 2\n7 2", "10 2\n1 6\n2 7"] | 3 seconds | ["Yes", "Yes", "No", "Yes"] | NoteThe first two examples are illustrated below. Both images become the same as their respective original ones after a clockwise rotation of $$$120$$$ degrees around the center. | Java 8 | standard input | [
"implementation",
"hashing",
"strings"
] | dd7a7a4e5feb50ab6abb93d90c559c2b | The first line contains two space-separated integers $$$n$$$ and $$$m$$$ ($$$2 \leq n \leq 100\,000$$$, $$$1 \leq m \leq 200\,000$$$) — the number of points and the number of segments, respectively. The $$$i$$$-th of the following $$$m$$$ lines contains two space-separated integers $$$a_i$$$ and $$$b_i$$$ ($$$1 \leq a_... | 1,900 | Output one line — "Yes" if the image is rotationally symmetrical, and "No" otherwise (both excluding quotation marks). You can output each letter in any case (upper or lower). | standard output | |
PASSED | 6e69d12d422a631ded1ccda841a82b51 | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.util.*;
public class P062B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
String s = sc.next();
ArrayList<TreeSet<Integer>> position = new ArrayList<>();
for (int i = 0;... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | b5941ebebc6bbf47831cfac94185f278 | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main{
static String original;
static boolean[] exists;
static List[] indexes;
static int[] closest;
static int k;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | f54950b2b9ff68d26c28958d463d4a6c | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.util.*;
import java.io.*;
public class B62 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int k = in.nextInt();
String s = in.next();
int next_left[][] = new int[200001][26];
int next_right[... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | 2e86be77a09fc8209d654ad2c92eec4b | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class CodeD
{
static class Scanner
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Strin... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | 983fdc233420312ec89564cec588b776 | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.io.*;
import java.util.*;
public class B62 {
BufferedReader br;
StringTokenizer in;
PrintWriter out;
ArrayList<Integer>[] pos;
public String nextToken() throws IOException {
while (in == null || !in.hasMoreTokens()) {
in = new StringTokenizer(br.readLine());
... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | de494057d2c7ed4fe1ebda93b46f5750 | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 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.Collections;
import java.util.HashMap;
import java.util.StringTokenizer;
public class Counting {
public static void main(String[] args) throws IOException ... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | efc5ebdb9880fa4d79db58ad979a2a7f | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
public class Tynder_Brome {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStr... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | 8de3e06d924135bb95983dd8be90f8a6 | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Main {
static ArrayList<Integer>[] arreglos;
static int length;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(n... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | 55753d3184031d02ef573b1273c77d2c | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Main {
static ArrayList<Integer>[] arreglos;
static int length;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(n... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | 9db7fcb08863de521f7a67e72f774d98 | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Main {
static ArrayList<Integer>[] arreglos;
static int length;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(n... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | f358ddb0cbd415081b07b13a01cacd20 | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Scanner;
public class Main{
static ArrayList<Integer> index[] = new ArrayList[27];
static String usuario;
public static int router(char c){
if(c=='a'){
return 1;
}
else{
return (int) c... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | c87e7f99979b1b2808c06a3194c199be | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Scanner;
public class Main{
static ArrayList<Integer> index[] = new ArrayList[27];
static String usuario;
public static int router(char c){
if(c=='a'){
return 1;
}
else{
return (int) c-... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | 63d78e9f551c1d4b1f50580c23185144 | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class tyndexBrome {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | c9a9ed2c51858d650d524396a436e0d6 | train_000.jsonl | 1298649600 | Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!The popularity of the new browser is growing daily. And the secret is not even the Tyndex.Bar installed (the Tyndex.Bar automatically fills the glass with the finest 1664 cognac a... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class tyndex {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
Str... | Java | ["2 10\ncodeforces\ncodeforces\ncodehorses", "9 9\nvkontakte\nvcontacte\nvkontrakte\nvkollapse\nvkrokodile\nvtopke\nvkapuste\nvpechke\nvk\nvcodeforcese"] | 2 seconds | ["0\n12", "18\n14\n36\n47\n14\n29\n30\n0\n84"] | null | Java 7 | standard input | [
"binary search",
"implementation"
] | a587188db6f0c17927923a158fdca1be | The first line contains two integers n and k (1 ≤ n ≤ 105, 1 ≤ k ≤ 105). They are the number of potential addresses and the length of the address entered by the user. The next line contains k lowercase Latin letters. They are the address entered by the user (s). Each next i-th (1 ≤ i ≤ n) line contains a non-empty sequ... | 1,800 | On each n line of the output file print a single number: the value of the error function when the current potential address is chosen. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d). | standard output | |
PASSED | 46a9826ce55d05d2fadd493e6122f742 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.util.*;
public class MakeItOne {
static int LIM = 300001;
public static void main (String [] arg) throws Throwable {
int [] sieveprimes = new int [LIM];
int [] factorization = new int [LIM+1];
int [] prev = new int [LIM+1];
int [] primecount = new int [LIM+1];
boolean [] composite = new boolean ... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 554ea0aeea708640121ce5ab1b940756 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 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.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
imp... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 64800aedf1c54849798f93c95e9167db | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
/**
* @author Don Li
*/
public class MakeItOne2 {
int N = (int) 3e5 + 10;
int SQRT = (int) (Math.sqrt(N) + .5);
int[] fp = new int[N];
int[][] ... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | cedaa7838bf885f2abfbafd0f62b9f05 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class MakeItOne {
int N = (int) 3e5 + 10;
int MOD = (int) 1e9 + 7;
int[] fac = new int[N], ifac = new int[N],... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 8f9022ffabb1cf9600c05b1660d0e6f6 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHel... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 963e02cfe25f460376382aec2da9bbb6 | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution ... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | 343f4af2d59ff5555905ae01378232ae | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
FastReader scn;
PrintWriter out;
String INPUT = "";
void solve() {
int n = scn.nextInt();
int[] arr = new int[300001];
for(int i = 0; i < n; i++) {
int x = scn.nextInt();
arr[x] = 1;
}
int[] a = new int[n];
int pos = 0;
for(int i = 1; i < ... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output | |
PASSED | a55e7dc3ca20e9e27eddfb58dd7926de | train_000.jsonl | 1540740900 | Janusz is a businessman. He owns a company "Januszex", which produces games for teenagers. Last hit of Januszex was a cool one-person game "Make it one". The player is given a sequence of $$$n$$$ integers $$$a_i$$$.It is allowed to select any subset of them, and the score is equal to the greatest common divisor of sele... | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
FastReader scn;
PrintWriter out;
String INPUT = "";
void solve() {
int n = scn.nextInt();
int[] arr = new int[300001];
for(int i = 0; i < n; i++) {
int x = scn.nextInt();
arr[x] = 1;
}
int[] a = new int[n];
int pos = 0;
for(int i = 1; i < ... | Java | ["3\n10 6 15", "3\n2 4 6", "7\n30 60 21 42 70 15 30"] | 3 seconds | ["3", "-1", "3"] | NoteIn the first example, selecting a subset of all numbers gives a gcd of $$$1$$$ and for all smaller subsets the gcd is greater than $$$1$$$.In the second example, for all subsets of numbers the gcd is at least $$$2$$$. | Java 8 | standard input | [
"dp",
"combinatorics",
"number theory",
"bitmasks",
"shortest paths",
"math"
] | 3baa00206d3bf03ce02a414747e2a633 | The first line contains an only integer $$$n$$$ ($$$1 \le n \le 300\,000$$$) — the number of integers in the sequence. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 300\,000$$$). | 2,500 | If there is no subset of the given sequence with gcd equal to $$$1$$$, output -1. Otherwise, output exactly one integer — the size of the smallest subset with gcd equal to $$$1$$$. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.