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 | 12d655c6133ebda590fbb69f4ad06218 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.io.*;
public class C {
// *** ++
// +=-==+ +++=-
// +-:---==+ *+=----=
// +-:------=... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 7833f7f51baff767725948bc8be6ef84 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | /*
bts songs to dance to:
ON
*/
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class x1514C
{
public static void main(String hi[]) throws Except... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 97234107f487a38d4eb781e44f1b5a40 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
TreeSet<Long> list = new TreeSet<>();
long res = 1;
for(long i = 1; i < n; i++) {
if(gcd(i, n) == 1) {
res *= i; res %= n;
list.add(i);
}
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | e60cea67c27b336ba4f02f60594ef20b | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.Scanner;
public class C1514 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
boolean[] include = new boolean[N+1];
long product = 1;
for (int n=1; n<N; n++) {
if (gcd(n, N) == 1) {
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 64c70b3e918e92f060243f02f7d5f9c1 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.function.*;
public class Product1ModuloN {
public static void solve(FastIO io) {
final int N = io.nextInt();
IntList coprimes = new IntList();
long currMod = 1;
for (int i = 2; i < N; ++i) {
if (gcd(i, N) == 1) {
coprimes.add(i);
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 13d5641206c686320314f817e2ba21e3 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
public class C{
static FastScanner fs = null;
public static void main(String[] args) {
fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int t = 1;
while (t-->0) {
long pr = (long)1;
int n = fs.nextInt();
ArrayList<Integer> list = ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 6c9d01754a5cc004b62a7a77c6960f75 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class JaiShreeRam{
static Scanner in=new Scanner();
static long systemTime;
static long mod = 1000000007;
static ArrayList<ArrayList<Integer>> adj;
static int seive[]=new int[1000001];
stati... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | b7d3e3805b19ad54cb8f1bf2e77ecd61 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int i, j, k, n, m, t, y, x, sum = 0;
static long mod = 1000000007;
static FastScanner fs = new FastScanner();
static PrintWriter out = new PrintWriter(System.out);
static String str;
static long ans;
public stati... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 86bc2a8e4d09e7b096f83fa73fb53284 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | //package com.company;
import java.util.*;
import java.io.*;
public class Product1ModuloN {
private static int gcd(int a, int b) {
return b== 0 ? a : gcd(b, a % b);
}
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(Sy... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | c3c0824735d45913e237122619f693b3 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.Scanner;
import java.util.TreeSet;
public class Product1ModN {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
long N = scan.nextLong();
TreeSet<Long> ans = new TreeSet<>();
long p = 1;
for(long i = 1; i < N; i++)
if(gcd(i, N) == 1) {
a... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 070239b5a6a51b2340d90e511c3ef628 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author cpp
*/
public class Main {
pub... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 9741a8bb1830427e69c40c727f990ca0 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class productmodulon {
public static void main (String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(S... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 9423b816aa3d9839822337c87851c9a4 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
public class Omar {
static Scanner sc=new Scanner(System.in);
static PrintWriter pw=new PrintWriter(System.out);
public static long GCD(long a, long b) {
if (b == 0)
return a;
if (a == 0)
return b;
return (a > b) ? GCD(a % b, b) : GCD(a, b % a);
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | b71667cff05d16b0793dbb2423c49558 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class new1{
static int gcd(int a, int b)
{
if (b == 0)
return a;
return gcd(b, a % b);
}
public static void main(String[] args) throws IOException{
FastReader s = new FastReader();
BufferedWriter output = new Buffered... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | c945480fdeff08be0332e16e4fbe36dc | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
// import java.lang.*;
// import java.math.*;
public class Codeforces {
static FastReader sc=new FastReader();
static PrintWriter out=new PrintWriter(System.out);
static long mod=1000000007;
// static long mod=998244353;
static int MAX=Integer.MAX_VALUE;
static... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 6a6b6457c449d2d0e1077e205f82e446 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.util.*;
//import com.sun.management.internal.GcInfoCompositeData;
import java.io.*;
public class Solution {
static FastScanner scr=new FastScanner();
// static Scanner scr=new Scanner(System.in);
static PrintStream out=new PrintStream(System.out);
static StringBuilder sb=new StringBu... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 55c7cd65b0fdbc54d1ca6bda596aed49 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
public static void main(String[] args) {
FastReader f = new FastReader();
StringBuffer sb=new StringBuffer();
int n=f.nextInt();
int a[]=new int[n-1];
for(int i=0;i<n-1;i++)
a[i]=i+1;
TreeSet<Integer> list=new TreeSet<>();
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | f50df11505ef1d95be116f91db01258f | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import jav... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 30b3ba46d12c566330879d9ff88cbc9a | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
StringBuffer out=new StringBuffer();
int t=1;
outer:
while(t--!=0) {
int n=in.nextInt();
boolean coprime[]=new boolean[n];
int cnt=0, rem=1;
for(int i=1; ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | a587a3d8237a45f9cadc0f971a64a69e | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private static int gcd(int a, int b) {
if(b == 0) {
return a;
}
return gcd(b, a%b);
}
public static void main(String[] args) throws IOException {
//BufferedReader f = new BufferedReader(new File... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 635c85366761a1b090ca9efbeb2e93c2 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
StringBuffer out=new StringBuffer();
int t=1;
outer:
while(t--!=0) {
int n=in.nextInt();
boolean coprime[]=new boolean[n];
int cnt=0, rem=1;
for(int i=1; i<n; i++) {
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 04afa118f25fdd185f350d142e2bb059 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;import java.io.*;import java.math.*;
public class CF1514C
{
static final Random random=new Random();
static boolean memory = true;
static void ruffleSort(int[] a) {
int n = a.length;
for (int i=0; i<n; i++) {
int oi=random.nextInt(n), temp=a[oi];... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 4b4ae6d9e3c51d7b8944df6ea3b1b159 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
static int MAX_N = 100010;
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | a89dbc8650f383d99c515644f77aef28 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
static Scanner scan = new Scanner(System.in);
public static int gcd(int a,int b){
return b==0 ? a:gcd(b,a%b);
}
public static void slove(){
int n = scan.nextInt();
int cnt =... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 7ac9f8318bc6899007696cd97609a427 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | /*----------- ---------------*
Author : Ryan Ranaut
__Hope is a big word, never lose it__
------------- --------------*/
import java.io.*;
import java.util.*;
public class Codeforces2 {
static PrintWriter out ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 17 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 60616b87f052db86b22c20008d8578a2 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | //https://codeforces.com/problemset/problem/1514/C
import java.util.*;
import java.io.*;
public class onemodn {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 17 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 7f9c45fd88dfe2cfbc0e13ba2a8deb92 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class First {
static int bl;
static int[] arr;
static int[] cnt;
static int[] freq;
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 089669ae403552531debfe4cbe31d2f2 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
// --------------------------------- Always Check AM PM -------------------------------
public class First {
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 8eeb6983ed96022eb2889cad2c160a70 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
// --------------------------------- Always Check AM PM -------------------------------
public class First {
static int bl;
static class answer1 implements Comparable<answer1> {
int a, b, c;
public answer1(int a, int b, int c) {
t... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | e395a0ab4ae9e6490e5302810a5198b3 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | //package Codeforces.Round716Div2;
import java.io.*;
import java.util.*;
public class First {
static class Query implements Comparable<Query>{
int id;
int start;
int end;
int blockno;
Query(int id, int start, int end, int blockno){
this.id = id;
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 7706bbd4b48d762fe0a0547a4aca15b8 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
public class D {
public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static void main(String[] args) throws IOException {
readInput();
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 0c28f4254f4036d38ec306b41084b609 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
public class Practice1 {
private static int block_size;
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | adbd49af573af097770eec6841301082 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
/*
10 4
1 1 2 1 2 1 1 2 1 1
1 7
2 8
1 10
4 10
*/
public class D{
static FastReader sc=null;
static int nax=(int) 3e5+ 5;
static int counts[];
static int freq[];
static int ans=0;
static int a[];
public static void main(String[] args) {
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | c92ba995b280601bdd10a7de708a7dba | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
/*
10 4
1 1 2 1 2 1 1 2 1 1
1 7
2 8
1 10
4 10
*/
public class D2{
static FastReader sc=null;
static ArrayList<Integer> pos[];
public static void main(String[] args) {
sc=new FastReader();
PrintWriter out=new PrintWriter(System.out);
i... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 85fd0df7771752afe7c76a204fd56b8e | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
/*
10 4
1 1 2 1 2 1 1 2 1 1
1 7
2 8
1 10
4 10
*/
public class D2{
static FastReader sc=null;
static Random rand=new Random();
static int nax=(int)1e6;
static ArrayList<Integer> pos[];
public static void main(String[] args) {
sc=new FastRead... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 5113e3461f1b0e867edd35e22f09e0d8 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.math.BigInteger;
//import javafx.util.*;
public final class B
{
static StringBuilder ans=new StringBuilder();
static FastReader in=new FastReader();
static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 16f03c11db9e603d6e1c7e6a9974f9da | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | // Credits: MagentaCobra
// Reason: Can't cope with sluggish Java.
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class x1514D
{
public static vo... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | ad289b761029db9f62722ce4d1ef8b7b | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.util.*;import java.io.*;import java.math.*;
public class Main
{
static int block;
static class Node
{
int l,r,ind;
Node(int l,int r,int ind)
{
this.l=l;
this.r=r;
this.ind=ind;
}
}
public static class C... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 2da9ce6224d1a49b4b4511702cde9f04 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
/**
*
* @Har_Har_Mahadev
*/
public class D {
private static long INF = 2000000000000000000L, M = 1000000007, MM = 998244353;
static int N = 4_000_01;
static int Block = (int) sqrt(N);
static int arr[] = new int[N];
static int ans[] = ne... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | bcbb8f5db4a77d0893f770f34bbda43c | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
public class Main{
static int[]occ,occofocc;
static int maxOcc;
static void add(int x) {
occofocc[occ[x]]--;
occ[x]++;
occofocc[occ[x]]++;
maxOcc=Math.max(maxOcc, occ[x]);
}
static void remove(int x) {
occofocc[occ[x]]--;
occ[x]--;
occofocc[occ[x]... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | ade47dac2dc954f8f8b016185e626d56 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
public class Main{
static int[]occ,occofocc;
static int maxOcc;
static void add(int x) {
occofocc[occ[x]]--;
occ[x]++;
occofocc[occ[x]]++;
maxOcc=Math.max(maxOcc, occ[x]);
}
static void remove(int x) {
occofocc[occ[x]]--;
occ[x]--;
occofocc[occ[x]... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 2416808ff548e640d47a75cf0b9f0f74 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
public class Main{
static int[]occ,occofocc;
static int maxOcc;
static void add(int x) {
occofocc[occ[x]]--;
occ[x]++;
occofocc[occ[x]]++;
maxOcc=Math.max(maxOcc, occ[x]);
}
static void remove(int x) {
occofocc[occ[x]]--;
occ[x]--;
occofocc[occ[x]... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 19342ae4ab772ef35d04f07406a75e92 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
public class Main{
static int log=19;
static ArrayList<Integer>[]occ;
static int[]in;
static int[][]dom;
static int[][]cnt;
static int numOcc(int l,int r,int x) {
if(l>r)return 0;
if(l==r) {
return in[l]==x?1:0;
}
int lo=0,hi=occ[x].size()-1;
int ... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 761600eb9d6beb071207c831b5d6c7da | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
public class CutandStick {
private static int block_size;
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 10a55a91f5d94d8f14a6e24a1c4a5eba | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
public class Main {
static long MOD = 1000000007;
static int[] readArray(int size, InputReader in, boolean subOne) {
int[] a = new int[size];
for (int i = 0; i < size; i++) {
a[i] = in.nextInt() + (subOne ? -1 : 0);
}
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | c21a6bae629cc2f496a8e2ff37bb71d8 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | /*
*
* CREATED BY : NAITIK V
*
*
*/
import java.util.*;
import java.io.*;
public class A
{
static FastReader sc=new FastReader();
static long dp[][];
static int mod=1000000007;
static int max=555;
static int large;
static int block_size=555;
static int F[]=new ... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 14d94d267ac8206e5d6a94e91812d1ad | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.util.*;
import java.io.*;
public class D3 {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
int q = sc.nextInt();
int[] arr = new int[n];
for(int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
WaveletTree wt = new WaveletTree(arr, 1, n);
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 3517f53422b920795ea26445412025ea | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.util.*;
import java.io.*;
public class D2 { //this is all wrong
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.nextInt();
int q = sc.nextInt();
ArrayList<Integer> arr = new ArrayList<>();
for(int i = 0; i < n; i++) {
int a = sc.nextInt();
arr.add(a)... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 16f9f50a46410afe13a932ee4325bbe7 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.Point;
public class Main {
static final long MOD = 1000000007L;
//static final long MOD2 = 1000000009L;
//static final long MOD = 998244353L;
//static final long INF = 500000000000L;
static final int INF = 100... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 48966728a782fd734890395ec66a41eb | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.Point;
public class Main {
static final long MOD = 1000000007L;
//static final long MOD2 = 1000000009L;
//static final long MOD = 998244353L;
//static final long INF = 500000000000L;
static final int INF = 100... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | b846c658d45961aeab955bed7c939408 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.Point;
public class Main {
static final long MOD = 1000000007L;
//static final long MOD2 = 1000000009L;
//static final long MOD = 998244353L;
//static final long INF = 500000000000L;
static final int INF = 100... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 1d01a844d5c1d336708edaa4f35fdb62 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.util.*;
import java.io.*;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static long mod = (long) 1e9 + 7;
static long inf = (long) 1e16;
static int n, m, k;
static ArrayList<Integer>[] ad;
static int[][] remove, add;
static long[][] memo, memo1[];
static boolean v... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 7bfb08607db6e0a47aee87921df60190 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
public class Practice1 {
private static int block_size;
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 9a679115ee4d3497708a829072788b1c | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) {new Main().run();}
FastReader in = new FastReader();
PrintWriter out = new PrintWriter(System.out);
void run(){
work();
out.flush();
}
long mod=1000000007;
long gc... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | aa728bcf399bd5a10dde151ce71bc18b | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
public final class Solution {
static PrintWriter out = new PrintWriter(System.out);
static FastReader in = new FastReader();
static long mod = (long) 1e9 + 7;
static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(1, 0), new Pair(0, -1), new Pair(0, ... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | f0c34caab8ac9ba1199b9c25b9b9d7ea | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | /*
bts songs to dance to:
Filter
*/
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class x1514D
{
public static void main(String hi[]) throws Ex... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | a2c4b5af2740e748e579d30fd1915e8b | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | /*
bts songs to dance to:
Filter
*/
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class x1514D
{
public static void main(String hi[]) throws Ex... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 2854303a12d9e39553ac02c65086d153 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | /*
bts songs to dance to:
Filter
*/
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
public class x1514D
{
public static void main(String hi[]) throws Ex... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 7f8510515a6f5775a76a0796de5fce57 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;import java.util.*;import java.math.*;
public class Main
{
public void tq()throws Exception
{
st=new StringTokenizer(br.readLine());
int tq=1;
sb=new StringBuilder(1000000);
o:
while(tq-->0)
{
int n=i();
int q=i();
int ar[]=ari(n);
int qq[][]=new int[q][3];
i... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | d4aa9efb3a9836e35bb41b5d570eb1e8 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.util.*;
import java.io.*;
public class D
{
static InputReader in=new InputReader(System.in);
static OutputWriter out=new OutputWriter(System.out);
static StringBuilder sb=new StringBuilder();
static int MAX = 3 * 100000 + 5;
static int n;
// Main Class Starts Here
pub... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | c228ea8b8c41d5815a96c45f5069441f | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.util.*;
import java.util.Map.Entry;
import java.math.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
InputReader in = new InputReader(System.in);
// Scanner in = new Scanner(System.in);
// Scanner in = new Scanner(new BufferedReader(new... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | e404c9bd9814230243e14db8fb89fd46 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.BufferedInputStream;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class P1514D {
p... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 94ca92280a45c96ec03f7e80b361041c | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.util.StringTokenizer;
import static java.lang.Math.*;
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 4fc0f2a25fd0314cf6a6b57631827cd0 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | // package FinalGrind;
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class CutAndStick {
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | aabc02d9cd684cf787b7ec0ff3be896a | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedR... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 8 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | f7c080d77dddcef6e15cf571e90a3439 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | //Utilities
import java.io.*;
import java.util.*;
public class a {
static int t;
static int n, q;
static int[] a;
static ArrayList<Integer>[] arr;
static int[] left, log2;
static Pair[] p;
public static void main(String[] args) throws IOException {
t = 1;
while (t-- > 0) {
n = in.iscan()... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | ea611e67595369321d0e50057bf74d26 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Random;
public class SolutionD {
// author: Nagabhushan ... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 1461c0ca710e3736b2cd22db83b6b804 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Random;
public class SolutionD {
// author: Nagabhushan S... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 06c48a6c25291a57bc512d3e44494045 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class SolutionD {
// PRIMARY VARIABLES
private static int n, m;
private static int[] a, b;
private static long ans;
private static int[][] id, dp;
private static int idf;
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | aa633a16b11dbf2f5e35aec0e6b131a3 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class SolutionD extends Thread {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | d4cd0838c826f784c883a312a8adb99a | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Random;
public final class D {
public static void main(String[] args) throws IOException {
final FastReader fs = new FastReader();
final StringBuilder... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 7aac8f355fa0e5a5236e257bab27ffb7 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes |
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Random;
public final class D {
public static void main(String[] args) throws IOException {
final FastReader fs = new FastReader();
final StringBuilder... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | eddd2bbb9471f32296392fcee4401a5d | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;
public class Main {
private static int[] a;
private static Vector<Integer>[] indexSets;
private static void run() throws IOException {
int n... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 75dc75330b189156c9b8f01d0863a1ed | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;
public class Main {
private static int[] a;
private static Vector<Integer>[] indexSets;
private static void run() throws IOException {
int n... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 0282cbb71548ddaf17601165d97f2bbe | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;
public class Main {
private static int[] a;
private static Vector<Integer>[] indexSets;
private static void run() throws IOException {
int n... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 35c3c3141c3d1df131cb3f17f1eedaa7 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;
public class Main {
private static int[] a;
private static ArrayList<Integer>[] indexSets;
private static void run() throws IOException {
in... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | a7871cda3adf84cded5778f57a713911 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | // practice with kaiboy, coached by rainboy
import java.io.*;
import java.util.*;
public class CF1514D extends PrintWriter {
CF1514D() { super(System.out); }
static class Scanner {
Scanner(InputStream in) { this.in = in; } InputStream in;
byte[] bb = new byte[1 << 15]; int i, n;
byte getc() {
if (i == n) {
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | a67a181a164fa351522b88237b5afc00 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | // practice with kaiboy
import java.io.*;
import java.util.*;
public class CF1514D extends PrintWriter {
CF1514D() { super(System.out); }
static class Scanner {
Scanner(InputStream in) { this.in = in; } InputStream in;
byte[] bb = new byte[1 << 15]; int i, n;
byte getc() {
if (i == n) {
i = n = 0;
t... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | fa13d6c121af53239225a0dafebaa4bb | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | // practice with kaiboy
import java.io.*;
import java.util.*;
public class CF1514D extends PrintWriter {
CF1514D() { super(System.out); }
static class Scanner {
Scanner(InputStream in) { this.in = in; } InputStream in;
byte[] bb = new byte[1 << 15]; int i, n;
byte getc() {
if (i == n) {
i = n = 0;
t... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | a535fba9f863a832cc54bc8c3a80c467 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | // practice with kaiboy
import java.io.*;
import java.util.*;
public class CF1514D extends PrintWriter {
CF1514D() { super(System.out); }
static class Scanner {
Scanner(InputStream in) { this.in = in; } InputStream in;
byte[] bb = new byte[1 << 15]; int i, n;
byte getc() {
if (i == n) {
i = n = 0;
t... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | a687be8939f17f4cdf47aacc2d35d661 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.*;
public class CF1514D extends PrintWriter {
CF1514D() { super(System.out); }
static class Scanner {
Scanner(InputStream in) { this.in = in; } InputStream in;
byte[] bb = new byte[1 << 15]; int i, n;
byte getc() {
if (i == n) {
i = n = 0;
try { n = in.read(bb); } ... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | be67477069abae4e69906ce5f5485437 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.*;
public class CutAnsStick implements Runnable {
int[][] counts;
// Use Randomized Algo (Time Complexity[nLog(n) + Q(Log(n)^2)]
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 461a0663b923f26b8c453c2bb7338bd9 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.*;
public class CutAnsStick implements Runnable {
int[][] counts;
// Use Randomized Algo (Time Complexity[nLog(n) + Q(Log(n)^2)]
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 7427f36a0195df706727fd5e3b97b582 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.*;
public class CutAnsStick implements Runnable {
int[][] counts;
// Use Randomized Algo (Time Complexity[nLog(n) + Q(Log(n)^2)]
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 0563d2379f04cec5914a026c16a29943 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.*;
public class CutAnsStick implements Runnable {
int[][] counts;
// Use Randomized Algo (Time Complexity[nLog(n) + Q(Log(n)^2)]
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 37342e6fe50d754273df7e919a25a0b7 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.*;
public class CutAnsStick implements Runnable {
int[][] counts;
void solve() throws IOException {
int n = ri(), q = ri... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | ddffba75daaee551cdf589eda73ef6e8 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.*;
public class CutAnsStick implements Runnable {
int[][] counts;
void solve() throws IOException {
int n = ri(), q = ri... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 0d4dae8bb42179ec31dcbcffbc13ba24 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.*;
public class CutAnsStick implements Runnable {
int[][] counts;
void solve() throws IOException {
int n = ri(), q = ri();
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 6a11ede2e340700ad3457fafd928e0a8 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.awt.*;
import java.io.*;
import java.sql.Array;
import java.util.*;
import java.util.List;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
n... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | e0ddd521b7dbd7101faea207c64984c3 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.awt.*;
import java.io.*;
import java.sql.Array;
import java.util.*;
import java.util.List;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
n... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 8574b4b7108d5ebd172fd6f062591ad6 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | //https://codeforces.com/contest/1514/problem/D
//D. Cut and Stick
import java.util.*;
import java.io.*;
public class CF_1516_D{
static int seg_tree[];
static int a[];
static ArrayList<ArrayList<Integer>> al;
static int count(int start, int end, int val){
return upperbound(al.get(val), end) - lowerboun... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 84dcbf2fce647823790b2bca85b65e95 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.util.*;
import java.io.*;
public class CF_1516_D{
static int seg_tree[];
static int a[];
static ArrayList<ArrayList<Integer>> al;
static int count(int start, int end, int val){
return upperbound(al.get(val), end) - lowerbound(al.get(val), start);
}
static void build(int node, int start,... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 99425c98543e86669ed0316a36c59153 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | //package Codeforces.Round716Div2;
import java.io.*;
import java.util.*;
public class D_MosAlgo {
static class Query implements Comparable<Query>{
int id;
int start;
int end;
int blockno;
Query(int id, int start, int end, int blockno){
this.id = id;
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 35a2da4d8e75adb38e1ec4368e3ac034 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | //package Codeforces.Round716Div2;
import java.io.*;
import java.util.*;
public class D_MosAlgo {
static class Query implements Comparable<Query>{
int id;
int start;
int end;
int blockno;
Query(int id, int start, int end, int blockno){
this.id = id;
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 9fcf4d308d44999fe13738a3bfdb78d0 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.function.BiFunction;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.Buffere... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 6c58ecbf6f1c688930e2b76d54bbe3c9 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class First {
static int bl;
static int[] arr;
static int[] cnt;
static int[] freq;
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 2d3c6f46794ebfa529b392bea7f51d02 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | //package Codeforces.Round716Div2;
import java.io.*;
import java.util.*;
public class First {
static class Query implements Comparable<Query>{
int id;
int start;
int end;
int blockno;
Query(int id, int start, int end, int blockno){
this.id = id;
... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 3cb3b9e6e9d10631eddd1edd79572074 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class ACMIND
{
static FastReader scan;
static PrintWriter pw;
static long MOD = 1_000_000_007;
static long INF = 2_000_000_000_000_000_000L;
static long inf = 2_000_000_000;
public static void main(String[] ... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | 3e47c7c6e04320be3809b9b9fef18de3 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class D {
public static void main(String[] args) {
solve();
}
private static Reader reader = null;
private static Writer writer = null;
public static int getInt() {
int ... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output | |
PASSED | b78fd8fcc5ab3ab9a076f22fb597b3e0 | train_110.jsonl | 1618839300 | Baby Ehab has a piece of Cut and Stick with an array $$$a$$$ of length $$$n$$$ written on it. He plans to grab a pair of scissors and do the following to it: pick a range $$$(l, r)$$$ and cut out every element $$$a_l$$$, $$$a_{l + 1}$$$, ..., $$$a_r$$$ in this range; stick some of the elements together in the same or... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.Writer;
imp... | Java | ["6 2\n1 3 2 3 3 2\n1 6\n2 5"] | 3 seconds | ["1\n2"] | NoteIn the first query, you can just put the whole array in one subsequence, since its length is $$$6$$$, and no value occurs more than $$$3$$$ times in it.In the second query, the elements of the query range are $$$[3,2,3,3]$$$. You can't put them all in one subsequence, since its length is $$$4$$$, and $$$3$$$ occurs... | Java 11 | standard input | [
"binary search",
"data structures",
"greedy",
"implementation",
"sortings"
] | d6c228bc6e4c17894d9e723ff980844f | The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 3 \cdot 10^5$$$) — the length of the array $$$a$$$ and the number of queries. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{n}$$$ ($$$1 \le a_i \le n$$$) — the elements of the array $$$a$$$. Each of the next $$$q$$$ ... | 2,000 | For each query, print the minimum number of subsequences you need to partition this range into so that the partitioning is beautiful. We can prove such partitioning always exists. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.