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 | 2823bfde5c413499755e6f0c3ac15d66 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.*;
import java.util.*;
import java.util.LinkedList;
import java.math.*;
import java.lang.*;
import java.util.PriorityQueue;
import static java.lang.Math.*;
@SuppressWarnings("unchecked")
public class solution implements R... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | fad7fbfb3b1be0acd0d8bf81b1a05120 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 7ee6a86cef8513a97ffc5ae5bdf2059a | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.util.*;
import java.io.*;
public class codeforces
{
public static void main(String[] args)
{
InputReader in = new InputReader(System.in);
PrintWriter pw = new PrintWriter(System.out);
int n = in.nextInt();
int seg1 = 0, seg2 = 0, mins = 0, smin = 0, min = Integer.MAX_VALUE... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 92a6ab6712b42bc7106eb08230215997 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 9237c28be7dd6bfaf2694a5e3186f729 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
/*
* Author : joney_000[developer.jaswant@gmail.com]
* Algorithm : N/A
* Platform : Codeforces
* Ref :
*/
public class A{
private InputStream inputStream ;
private OutputStream outputStream ;
private FastReader in ... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 3ddb51d3825e8669ccd604e515cdbe4a | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution
{
static class InputReader
{
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
public InputReader(InputStream... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | a3de52c6471409d5265ef1df4448dce0 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | //package Contest502;
import java.util.Scanner;
public class main502C {
public static Scanner enter = new Scanner(System.in);
public static void main(String[] args) {
int n=enter.nextInt();
int kor = (int)Math.round(Math.sqrt(n));
int tmp=n%kor;
int h=n/kor;
for (int i ... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 092afac345ec13393edf01a7a6c44b28 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 936cab95e21d1b5962f80994086e52d9 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Task {
public static void main(String[] args) throws IOException {
new Task().go();
}
PrintWriter out;
Reader in;
BufferedReader br;
Task() throws IOException {
try {
//br = new BufferedReader( new FileReader("... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | b99ffd065f3cf1f2d6442e8b68f6b463 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.util.*;
public class Test { public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int n= sc.nextInt();
int x= (int)Math.sqrt(n) ;
int a[] = new int[n+5];
for(int i=1,o=n,j;i<=n;i+=x)
for(j=(int)Math.min(i+x-1,n);j>=i;a[j--]=o--);
for(int i=1;i<=n;i++)System.out.print(a[i]+" ");
Syste... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 17be38aacfbdc2af49b6fcd7ef9b9720 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class problem1017C {
public static void main(String[] args) {
Scann... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 26f9cb722d586d8e55946b161124bf17 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.util.Scanner;
public class Class1 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int n=input.nextInt();
input.close();
int lim=(int) Math.ceil(Math.sqrt(n));
int[] arr=new int[lim*lim];
for(int i=n-(lim*lim)+1;i<=n;i++)
arr[i+(lim*lim)-n-1]=i;
for(int i=l... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 83ff05922ced77dbfa2b3ad1c14328fc | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* @author khokharnikunj8
*/
public class Main {
public static void main(String[] args) {
... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 09244a794e841789b5f67f2360ee2091 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
import java.util.Map.Entry;
public class Main
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 08e32330f2014c29378a79f092bf7334 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
public class DivCmb_502C {
public static void main(String[] args) throws IOException {
BufferedReade... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 96049e09e1ad6e66cdaa84b300d72e9c | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | // No sorceries shall prevail. //
import java.util.*;
import javafx.util.*;
import java.io.*;
public class InVoker {
//Variables
static long mod = 1000000007;
static long mod2 = 998244353;
static FastReader inp= new FastReader();
static PrintWriter out= new PrintWriter(System.out);
public static void m... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 51396af15d2b023776d969c64e0f193b | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main3
{
static class Reader
{
private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
public int read() {if (n... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | f2757993476cde802a03e7d43f88c5ad | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.InputMismatchException;
import java.util.List;
public class Main {
private static final int MAXN... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 1809bb22d59d988036508180c22816ed | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.*;
import java.util.*;
public class C1017 {
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | a0b514da755b0d9239f56a2e7b9b689d | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.util.*;
import java.io.*;
public class TaskC {
FastScanner in;
public void solve() throws IOException {
int n = in.nextInt();
int min = n + 1;
int k = 1;
for (int i = 2; i <= n; i++) {
int x = i + n / i;
if (n % i != 0) {
x++;
}
if (x < min) {
min = x;
k = i;
}
}
i... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | ad941979e26cf53472e5e8bc30a6902f | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.*;
import java.lang.annotation.Retention;
import java.util.*;
import java.math.BigInteger;
import java.util.Map.Entry;
import static java.lang.Math.*;
public class C extends PrintWriter {
int inc(int... p) {
int n = p.length;
int[] d = new int[n];
int max = 1;
for... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | ff234f09a879e2105d0583f4ba179628 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
public class Solution
{
static class InputReader
{
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
public InputR... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | da7cc03d828e3488bc776cf098e35116 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | //package sudo_plac;
import java.util.*;
public class phone_number {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int b=Integer.MAX_VALUE;
int lm=n;
int fact=0;
int en=0;
for(int i=1;i<=Math.sqrt(lm);i++) {
//System.out.println(i+" "+lm/i+" "+(i+1+lm... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 6bae6dcc20c9d06adda3bb1e759510f3 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | /**
* Created by Baelish on 8/8/2018.
*/
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class C {
public static void main(String[] args) throws Exception {
FastReader in = new FastReader(System.in);
PrintWriter pw = new PrintWriter(... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | b5c1d883d023a00d75adaf687a1b61a2 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes |
import java.util.Scanner;
public class ThePhoneumber {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s = new Scanner(System.in);
int n = s.nextInt();
StringBuilder sb = new StringBuilder();
int rem = (int) Math.sqrt(n);
int l =1,r = rem;
while(n>=l) {
for(int i... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | e8bcae5bd373ff7df0e8ff5bc1450b3b | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.util.Scanner;
public class CF1017C {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int k = (int)(Math.sqrt(n));
for (int i = 1; i <= n / k; i++) {
for (int a = 0; a < k; a++) {
System.out.pr... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 7232c9a8225a374356e29ccd874232ab | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.util.Scanner;
public class Nonzero {
public static int sumOfArrayElements(int[] a)
{
int sum = 0;
for (int i = 0; i < a.length; i++)
{
sum += a[i];
}
return sum;
}
public static int zeroCounter(int[] a)
{
int counter = 0;... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 24172a2f96e5d8aa1a2966c018139b0a | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.util.StringTokenizer;
public class code
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public Fas... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 150949a6fba1cfc2e4e53c53de5dca7c | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.util.*;
public class Problem1300A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int testCases, arrlength;
testCases = in.nextInt();
for (int i = 0; i < testCases; i++) {
int Sum = 0, Counter = 0, minStep;
arrlen... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 6d60a28bc3153ee1dee1f601bc0c14f9 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | // @author Hassan_Kaka
import java.util.Scanner;
public class NonZero_1300A {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int counter = 0;
int sum = 0;
int arrNumbers[];
int arrLen;
int numberOfCases = input.nextInt();
... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 000dff796bb71de8155b453a94c3abb9 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes |
import java.util.Scanner;
/**
*
* @author Hp
*/
public class Force2 {
/**
* @param args the command line arguments
*/
static Scanner input = new Scanner(System.in);
public static void main(String[] args) {
//ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 37faa9267a9b560dd55bb3745f0596b7 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | //import java.io.BufferedReader;
//import java.io.IOException;
//import java.io.InputStreamReader;
//import java.util.*;
//import java.math.*;
//
//
//public class Codeforces {
// public static String[] longestCommonSubsequence(String str1, String str2,int ind) {
// // Write your code here.
// int n=st... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 8dc429e7cb53a755574da37a6d1975d7 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next() {
while (st ... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 15f05abcf12f505f39522e0ef317f1da | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.Math;
import java.time.*;
//100
//0 0 -60 0 20 0 -85 0 0 0 -88 -77 83 0 10 0 98 0 1 68 0 0 0 0 0 0 -46 -95 0 -63 0 0 0 41 5 21 -60 0 -23 0 32 61 0 0 67 -87 73 -88 0 0 0 56 0 27 0 0 0 0 -42 -49 59 0 -74 -34 0 0 42 0 0 0 55 -36 -59 0 0 94 0 0 -58 54 0 2 67 0 0 0 10... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 9ab8fb08876b3ddde3e0c60b5dad3719 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.util.*;
public class mohammad
{
public static void main (String[]args)
{
Scanner U = new Scanner (System.in);
int t = U.nextInt();
while(t!=0){
int n = U.nextInt();
int[] a = new int[n];
int sum = 0, c =0;
for(int i=0 ; i<n ; i++){
a[i] = U.n... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | c62331a6cab2440e6e17940974ff5884 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class DynamicProgramming {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
for (int i = 0; i < n; i++){
int size = scn.nextInt();
int[] arr = new int[size];
for(int j = 0 ; j < size ; j++)
... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | f50ac584872bfe715245a73571f4bcf5 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.io.IOException;
import java.util.Scanner;
public class Solutions {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i =0; i < t; i++) {
int n = sc.nextInt();
int []a = new int[100];
int p = 1;
int s = 0;
... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 9d9f51f89009526531935c92ea620fbc | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.util.*;
/**
*
* @author Razan
*/
public class JavaApplication64 {
/**
* @param args the command line arguments
*/
//import java.util.Scanner;
/**
*
* @author Razan
*/
//import java.util.Scanner;
/**
*
* @author Razan
*/
//import java.util.Scanner;
/**
*
* @author Razan
*/
stat... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | bf7d2bbc3c7a4ecf5df09149e68806c5 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
public class _p001300A {
static public void main(final String[] args) throws jav... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | a8e3a79592982ec6310d133582d4c89b | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.stream.Collectors;
public class _p001300A {
static public void main(final String[] args)... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 989090317f639ed973990594936a3b74 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
for(int i = 0 ; i < t ; i++) {
int n = input.nextInt();
int sum = 0;
long product = 0;
int countZeros = 0;
... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | a8eebef3df5037d87968df145d1519a5 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
for(int i = 0 ; i < t ; i++) {
int n = input.nextInt();
int [] a = new int [n];
int sum = 0;
long product = ... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 0cce92d8745db9bd6204b137f85a86d9 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
int t = input.nextInt();
for(int i = 0 ; i < t ; i++) {
int n = input.nextInt();
int [] a = new int [n];
int sum = 0;
long product = ... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 826a53e99eb0b45e0cca5540f9e9cf13 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class NonZero {
public static void main(String[] args) throws NumberFormatException, IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
int T =... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | e0fe9367104bf12628ca11b03750ce77 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes |
/*
-> Written by <-
-----------
|J_O_B_E_E_L|
|___________|
| ___ |
| (^_^) |
| /( | )\ |
|____|_|____|
*/
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
import java.util.Map.*;
public class Test {
static PrintWriter pw=ne... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 9922298ce4856e2ed70998a5f3008f74 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class Q2 {
public static void main(String[] args)
{
YScanner in = new YScanner();
int t = in.nextInt();
for(int i = 0... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 0c3923a68f88b15b6fdf3c2031279482 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes |
import java.util.Scanner;
public class nonzero {
public static void main(String[] args) {
Scanner sc=new Scanner (System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
int ar[]=new int[n];
int z=0;
for(int i=0;i<n;i++)
{
ar[i]=sc.nextInt();
if(... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 063652fd90cb6dbcef5575654e087085 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 1bf74149b88e97e23fb2dc1e69e9bab7 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.io.*;
import java.util.*;
public class utkarsh {
public static void main(String[] args) {
new utkarsh().run();
}
BufferedReader br;
PrintWriter out;
long mod = (long) (1e9 + 7), inf = (long) (3e18);
void solve() {
int t = ni();
while(t-- > 0)... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | b6a5af7ffcc41f2c633569fef5a940a9 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.io.*;
import java.util.*;
public class utkarsh {
BufferedReader br;
PrintWriter out;
long mod = (long) (1e9 + 7), inf = (long) (3e18);
void solve() {
int t = ni();
while(t-- > 0) {
int n = ni();
int a[] = new int[n];
int an... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 0c23d14255daf44dd7c31385464fb36b | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader (System.in));
int test = Integer.parseInt(br.readLine());
for(int t = 0; t < test; t++){
int n = Intege... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 045c2d6a2ae8467ac44190199cd77863 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class ct1{
public static void main(String[] args) {
Scanner inp = new Scanner(System.in);
int x = inp.nextInt();
while (x-->0){
int n = inp.nextInt();
... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 8e275a217e12d5f1e9a53aa90d617c87 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.util.*;
public class V
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int x=0;x<t;x++)
{
int g=sc.nextInt();
int a=0;
int b=0;
for(int y=0;y<g;y++)
{
... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 2616c99a01a6c4a5d25e5cbf40db7e88 | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes | import java.util.Scanner;
public class A_1300 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner s= new Scanner(System.in);
int t = s.nextInt();
outer:
for(int tt =0;tt<t;tt++) {
int n = s.nextInt();
int[] a = new int[n];
int sum = 0,prod = 1,pc=0;
int i=0;
... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | 500da8dfe9d3544084a9a49fabbc8f4f | train_003.jsonl | 1581257100 | Guy-Manuel and Thomas have an array $$$a$$$ of $$$n$$$ integers [$$$a_1, a_2, \dots, a_n$$$]. In one step they can add $$$1$$$ to any element of the array. Formally, in one step they can choose any integer index $$$i$$$ ($$$1 \le i \le n$$$) and do $$$a_i := a_i + 1$$$.If either the sum or the product of all elements i... | 256 megabytes |
import java.util.*;
public class NonZero {
public static Scanner scn = new Scanner(System.in);
public static void main(String[] args) {
int t = scn.nextInt();
while(t-->0) {
int n = scn.nextInt();
int[] a = new int[n];
int p = 1 ;
int s = 0 ;
int b = 0;
int count1 =0 ;
int count2 = 0 ;
... | Java | ["4\n3\n2 -1 -1\n4\n-1 0 0 1\n2\n-1 2\n3\n0 -2 1"] | 1 second | ["1\n2\n0\n2"] | NoteIn the first test case, the sum is $$$0$$$. If we add $$$1$$$ to the first element, the array will be $$$[3,-1,-1]$$$, the sum will be equal to $$$1$$$ and the product will be equal to $$$3$$$.In the second test case, both product and sum are $$$0$$$. If we add $$$1$$$ to the second and the third element, the array... | Java 8 | standard input | [
"implementation",
"math"
] | 1ffb08fe61cdf90099c82162b8353b1f | Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^3$$$). The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the size of the array. The second line of each test case contains ... | 800 | For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. | standard output | |
PASSED | fe7a668b9df0ad08f1efbe542d0d8f99 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 1b655490f9a7cc4498f000a5b64b7d47 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Scanner;
public class D {
// 21:30-
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
Buffere... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | e8874c85b7f9d98c5e189feede92efc5 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
import java.util.stream.Collectors;
public class Main {
private static IO io = new IO();
public static void main(String[] args)throws IOException {
int n = io.ge... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 89e69a760c42b658706deb8dec25d663 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.IntStr... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 06d9f165fc1ca1ffb6dc6be9b327e4fd | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes |
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.Vector;
publ... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 227d3a829351f818ab5ffd56e38f09ce | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args){
FastScanner scan = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int n = scan.n... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 9c0da6b9b93bc9aa4889e9f52259f276 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes |
import java.io.*;
import java.util.StringTokenizer;
public class D {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner();
PrintWriter out = new PrintWriter(System.out);
int n = sc.nextInt();
int[] p = new int[n];
boolean[] done = new bool... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | be3e1d4a35a12d15015f4e29298bd0d0 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | /**
* DA-IICT
* Author : PARTH PATEL
*/
import java.io.*;
import java.math.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;
public class D876 {
public static int mod = 1000000007;
static Fa... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 6b868f897de39cb686754ad870645cf1 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Stack;
import java.util.StringTokenizer;
public class C {
public static void main(String[] args) throws NumberFormatException, IOException {
Scanner sc = new Scanner();
PrintW... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 5a76885d684a4b02af12db323ea21a12 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.util.*;
import java.io.*;
import java.lang.Math.*;
public class MainA
{
static int mod = (int) 1e9 + 7;
static int prime[]=new int[100000+1];
public static void main(String[] args) throws java.lang.Exception
{
InputReader in = new InputReader(System.in);
PrintWriter out=new PrintWriter(System.out)... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 13d19fc39b1399140e28050616d6a271 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 025d7203702599468c645c7aa97b7f5c | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;
//package acm_practice;
/**
*
* @author ghost
*/
public class Round_441 {
public static void main(String args[])
{
//File file= new File("COMPLETE_FILE_PATH");
//Inpu... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | f0fedf8086f12c6eee7bcbfff3b0aeaa | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class D
{
public static void main(String[] args) throws IOException
{
Scanner sc = new Scanner(System.in);
PrintWriter pw =... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 92394bf665d876cd1324b9e64d4d2b53 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
@SuppressWarnings("unchecked")
public class P876D {
public void run() throws Exception {
print("1");
TreeSet<Integer> p = new TreeSet();
for (int n = nextInt(), i = n; i > 0; i--) {
p.add(nextInt());
w... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 7b58c01b3e67426f5a922505c88f7133 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes |
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.util.ArrayList;
public class D {
public static void main(String[] args) {
InputSt... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 8c83366533d916b7226448bd0d6fe1f0 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
import java.lang.*;
public class Main {
private static FastReader sc = new FastReader(System.in);
private static OutputWriter out = new OutputWriter(System.out);
public static void main(String[] args) throws Exception {
int n = sc.nextInt()... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | fce93308df28827ec8cdaaf9f8a4eaff | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.File;
import java.util.St... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 5f48894d5b9926d70457f00936e73282 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.u... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 4ee53871a03ff1019e55fe49a17e7bac | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.DataInputStream;
import java.io.PrintWriter;
import java.io.FileInputStream;
import java.io.IOException;
public class Main
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | aa976b1d5a0ff7cb27235a901ff6e179 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Yo {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.rea... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 87b23ea6e4dc910225dc8869c4e9dead | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Solution {
public static void main(String[] args) {
InputReader in = new InputReader();
PrintWriter out = new PrintWriter(System.out);
Thread th = new Thread... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 2e0eac9b6bd39809ed85286c288b1c58 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class Main {
public static void main(String[] args) throws IOException {
final BufferedReader inputRe... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 080f3c80c8851c3e6397a5718cbc9c4e | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class SortingCoins {
int N = (int) 3e5 + 10;
int n;
int[] t = new int[N];
void solve() {
n =... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 1f99ecf22cf0ddbba8b9997e9ec5679a | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class SortingCoins2 {
void solve() {
int n = in.nextInt();
int rightmost = n - 1;
int[] p = ne... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 9d8eecccc170ef20aec9356b61faeac6 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Sanket Makani
*/
public cl... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 1b806e6aa1f5c19692a1dd0e7db7362e | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.TreeSet;
import java.io.InputStream;
/**
* Built using CHelpe... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 6dba14ac815d4f82ef7eb0083d34e5f7 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.util.*;
import static java.util.stream.Collectors.toList;
public class Solution {
static MyScanner sc;
private static PrintWriter out;
static long M = 1000000007;
public static void main(String[] s) throws Exception {
StringBuilder stringBuilder = new StringBu... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | e1d5a4bc7febeb34ceb19c761f92893f | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class D {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Integer n = Integer.parseInt(br.readLine());
St... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 84e0b7ef0fb3fcaa4e3aab82bbed797d | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
* Created by dtnha on 10/17/2017.
*/
public class SortingCoins {
static class Reader {
static BufferedReader reader;
static StringTokeni... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 7f5a54b4489cdbbcade43ac8f8fd2b22 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
* Created by dtnha on 10/17/2017.
*/
public class SortingCoins {
static class Reader {
static BufferedReader reader;
static StringTokeni... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | df6e2a1750a98fdd10010cbd81c209c9 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.TreeSet;
public class AD {
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Inte... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 4dce3429234fb68fad79bb8f8d696729 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.util.*;
public class CF876_D2_D {
public static void main(String[] args)throws Throwable {
MyScanner sc=new MyScanner();
PrintWriter pw=new PrintWriter(System.out);
int n=sc.nextInt();
int [] a=new int [n];
for(int i=0;i<n;i++)
a[i]=sc.nextInt()-1;
boolean [] vis=new boo... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 05b17f002adf04ed0187a20962b20548 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
// InputStream inputStream = new FileInputStream("sum.in");
OutputStream outputStream = System.out;
// OutputStream outputStream ... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 25b94fc45c56dcaf01f791839cbbc55e | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
// InputStream inputStream = new FileInputStream("sum.in");
OutputStream outputStream = System.out;
// OutputStream outputStream ... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | b893650f269c89015871271ef7599af7 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
public class Main {
public static void main(String[] args) throws IOException {
FastScanner input = new FastScanner(System.in);
int N = input.nextInt(... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 79117ba61fb07ab3f3a768676095778e | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.util.*;
import java.text.*;
import java.io.*;
import java.math.*;
public class code5 {
InputStream is;
PrintWriter out;
static long mod=pow(10,9)+7;
static int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
void solve() throws Exception
{
int n=ni();
int a[]=na(n);
TreeSet<Integer> ts=new TreeSet<Integer>... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 0308ed8e1c44e9e0cb7a681e57809de0 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine()), maxJ = 0;
String[] input = br.readLine().split(" ");
... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | db0bd53798ceac74e71b81079051521d | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader() {
reader = new BufferedReader(new InputStreamReader(System.in), 32765);
tokenizer = null;
}
public InputReader(InputStream... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 2297c3bf85b20a06e4af2bdc5bc46f96 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes |
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Map;
i... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | f4e4977230dc7c70dee082f0f7568e09 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class TaskD {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine()), max = 0;
... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | cafe6b0908c5801c7977bf22e79d5eca | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.lang.Math;
import java.math.BigInteger;
public class Problem {
int INF = -1000 * 1000 * 1000 - 100;
int counter;
int[] arr;
int[] t;
void solve() throws IOException {
int n = rI();
out.print(1 + " ");
int curLast = n;
arr = new... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 1dacb5389ac36aa9b39c73a4853ee2bb | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastScanner sc=new FastScanner();
PrintWriter pw=new PrintWriter(System.out);
while(sc.hasNext()){
int n=sc.nextInt();
Integer[]shu=new Integer[n];
for(int i=0;i<n;i++)shu[i]=sc.nextInt();
int[]p=new i... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | dfd021ddc400cfb7ff2ccd2a52beb85d | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Stream;
public class D_441
{
public static final long[] POWER2 = generatePOWER2()... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | fa25a3cc273951e0aaaccf9c3bde02ab | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.io.*;
import java.util.*;
public class Solution {
public final static int MOD = 1000000007;
public static int count = 0;
public static int dx[] = {0,0,1,-1,1,1,-1,-1};
public static int dy[] = {1,-1,0,0,1,-1,1,-1};
public static int max = 0;
public static boolean flag;
public static LinkedList<Inte... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output | |
PASSED | 85ce3029a0a3c7b1700ecd6e1591c152 | train_003.jsonl | 1508151900 | Recently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things in order, that is why he wants his coins to be arranged in a row in such a way that firstly come coins out of circulation, and then... | 512 megabytes | import java.util.Scanner;
public class CodeForces_875B {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt(), j=n-1;
boolean[] vCoins = new boolean[n];
StringBuilder sCoins = new StringBuilder("1");
for (int i=0; i<n; i++)
{
vCoins[scan.nextInt()-1] ... | Java | ["4\n1 3 4 2", "8\n6 8 3 4 7 2 1 5"] | 1 second | ["1 2 3 2 1", "1 2 2 3 4 3 4 5 1"] | NoteLet's denote as O coin out of circulation, and as X — coin is circulation.At the first sample, initially in row there are coins that are not in circulation, so Dima will look through them from left to right and won't make any exchanges.After replacement of the first coin with a coin in circulation, Dima will exchan... | Java 8 | standard input | [
"two pointers",
"dsu",
"implementation",
"sortings",
"trees"
] | b97eeaa66e91bbcc3b5e616cb480c7af | The first line contains single integer n (1 ≤ n ≤ 300 000) — number of coins that Sasha puts behind Dima. Second line contains n distinct integers p1, p2, ..., pn (1 ≤ pi ≤ n) — positions that Sasha puts coins in circulation to. At first Sasha replaces coin located at position p1, then coin located at position p2 and s... | 1,500 | Print n + 1 numbers a0, a1, ..., an, where a0 is a hardness of ordering at the beginning, a1 is a hardness of ordering after the first replacement and so on. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.