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
dde898d9fcfbea473052389e2304cd32
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.*; import java.io.*; public class Main implements Runnable{ public void run() { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); Solve sol...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
294b139777e8c631b13c4ac8686b47e9
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.*; import java.util.*; public class vk18 { public static void main(String[]st) throws Exception { //Scanner scan=new Scanner(System.in); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s; s=br.readLine(); int i=0; long ...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
dca264a7f49cf539cf4a4d4a322b0076
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
/* Aman Agarwal algo.java */ import java.util.*; import java.io.*; public class B1178 { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
85b58c184384835cc4ab6d74f8102f49
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.PrintWriter; import java.util.LinkedList; import java.util.List; import java.util.Scanner; /** * */ /** * * https://codeforces.com/contest/1178/problem/B * * @author Maksim * */ public class WOWFactor { /** * @param args */ public static void main(String[] args) { final Scanner in =...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
60a6f5d80c540cad89b9cf4984700c18
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.*; import java.io.*; public class CFQB { public static void main(String args[]) throws Exception { Scan scan = new Scan(); Print print = new Print(); String string=scan.scanString(); int N=string.length(); long arr[] = new long[N]; for(int i=1;i<N;i++) { arr[i]=arr[i-1]; if(stri...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
42f334f5780cfd5ae17ed1fca1a0fae2
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.*; import java.io.*; public class CFQB { public static void main(String args[]) throws Exception { Scan scan = new Scan(); Print print = new Print(); String string=scan.scanString(); int N=string.length(); long arr[] = new long[N]; for(int i=1;i<N;i++) { arr[i]=arr[i-1]; if(stri...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
a600f0bfc7e87552a8d665c39a053780
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.*; public class GUESSPRM { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new B...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
aab42d414d900a71e61c727dabbb96fe
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.Scanner; public class wowFactor { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); String in = scan.next(); long totalWs=0; for(int i=0;i<in.length()-1;i++){ if(in.charAt(i)=='v'&&in.charAt(i+1)=='v') totalWs++; } ...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
ad04e4ac4d1b539b3ecf9c6412c64185
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.Scanner; public class WOWfactor { public static void main(String args[]) { Scanner in = new Scanner(System.in); String s =in.nextLine(); int n = s.length(); long a=0,b=0,c = 0 ; for (int i = 1; i < s.length(); ++i) { if (s.charAt(i) == 'o') { b += a; ...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
38bef5e42b5a214587337816c5f37317
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
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
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
5bd45a178a57c7645d39b52f212bf944
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.*; public class div573{ public static void main(String sp[]){ Scanner sc = new Scanner(System.in); String st = sc.next(); int n = st.length(); ArrayList<Long> left = new ArrayList<>(); ArrayList<Long> right = new ArrayList<>(); for(int i=0;i<n;i++){ left.add(0l); right.add(...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
58d7efd4f164fb5c2186b9ee2e88e296
train_003.jsonl
1563636900
Recall that string $$$a$$$ is a subsequence of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero or all) characters. For example, for the string $$$a$$$="wowwo", the following strings are subsequences: "wowwo", "wowo", "oo", "wow", "", and others, but the following are not s...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); ArrayList<Long> arr = new ArrayList<Long>(); long ans=0,total=0, cont=0, atual=0; char last=' '; for(char c:s.toCharArray()) { if(c=='v') { if(last=='o') { ...
Java
["vvvovvv", "vvovooovovvovoovoovvvvovovvvov"]
1 second
["4", "100"]
NoteThe first example is explained in the legend.
Java 8
standard input
[ "dp", "strings" ]
6cc6db6f426bb1bce59f23bfcb762b08
The input contains a single non-empty string $$$s$$$, consisting only of characters "v" and "o". The length of $$$s$$$ is at most $$$10^6$$$.
1,300
Output a single integer, the wow factor of $$$s$$$.
standard output
PASSED
ae3c301d706ea8c1e6bb2f6b695dbd6d
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class p1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] array = new int[n]; for (int i = 0; i < n; ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
3dc3e723105af598b4315cb7aa5ff9e5
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Solution{ public static void incSub(int[] a, int n){ OutputStream outputStream = System.out; PrintWriter out = new PrintWriter(outputStream); StringBuffer sb = new StringBuffer(); int low = 0, high = n-1; int max ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
b0d176e3c9c525435de08c649bd62821
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.*; public class C2 { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int l=0; int r=n-1; int arr[]=new int[n]; for(int i=0;i<n;i++) { arr[i]=sc.nextInt(); } ArrayList<Integer> al=new ArrayList<Integer>(); int c=0; StringBuilder ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
00d14f8876ecf3e3d9b99752165c6748
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.u...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
21559bde4291effa36326c54c9a32ce9
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class D3 { public static void main(String[] Args){ Scanner scan=new Scanner(System.in); int n=scan.nextInt(); int[] arr=new int[n]; for (int i = 0; i <n ; i++) { arr[i]=scan.nextInt(); } Str...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
1b64da1a69c8d2cbe022e0f3a6eeaf7f
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.*; import jdk.nashorn.internal.ir.BreakableNode; public class Main { public static void main(String[] args) { Scanner a = new Scanner(System.in); int n = a.nextInt(); int[] data = new int[n]; for(int i=0; i<n; i++){ data[i] = a.nextInt(); } int r = n-1; int l = 0;...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
4edb6e6f29bceeed1e5e024bf2e3bfa4
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; import static java.lang.Math.abs; import static java.lang.Math.min; import static java.lang.Math.max; import static java.lang.Math.sqrt; import static java.lang.Integer.signum; @SuppressWarnings("unchecked") public class P1157C2 { ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
7ee7a4f584ecfbb388c86d498e2e67bb
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; import static java.lang.Math.abs; import static java.lang.Math.min; import static java.lang.Math.max; import static java.lang.Math.sqrt; import static java.lang.Integer.signum; @SuppressWarnings("unchecked") public class P1157C { p...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
4242286202ee4e43d60cc5d7f268b227
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); static int MOD = 1000000007; static int M = 505; static int oo = (int)1e9; public static void main(String[] args) throws IOException { ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
3da3c51bb60274fabf6e751bab1bd073
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); static int MOD = 1000000007; static int M = 505; static int oo = (int)1e9; public static void main(String[] args) throws IOException { ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
18a6bb055a96b2ee39a2cdab60f50792
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); static int MOD = 1000000007; static int M = 505; static int oo = (int)1e9; public static void main(String[] args) throws IOException { ...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
ccfee592ebd0a4831b909e993b6162b5
train_003.jsonl
1556289300
The only difference between problems C1 and C2 is that all values in input of problem C1 are distinct (this condition may be false for problem C2).You are given a sequence $$$a$$$ consisting of $$$n$$$ integers.You are making a sequence of moves. During each move you must take either the leftmost element of the sequenc...
256 megabytes
import java.util.Scanner; public class C{ public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a= new int[n+1]; for(int i = 0;i<n;++i) a[i] = in.nextInt(); int l = 0; int r = n-1; int last = -1; int count = 0; StringBuilder str = new StringBuild...
Java
["5\n1 2 4 3 2", "7\n1 3 5 6 5 4 2", "3\n2 2 2", "4\n1 2 4 3"]
2 seconds
["4\nLRRR", "6\nLRLRRR", "1\nR", "4\nLLRR"]
NoteThe first example is described in the problem statement.
Java 8
standard input
[ "greedy" ]
1ae1e051b6c8240eb27c64ae05c342cf
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of elements in $$$a$$$. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 2 \cdot 10^5$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.
1,700
In the first line of the output print $$$k$$$ — the maximum number of elements in a strictly increasing sequence you can obtain. In the second line print a string $$$s$$$ of length $$$k$$$, where the $$$j$$$-th character of this string $$$s_j$$$ should be 'L' if you take the leftmost element during the $$$j$$$-th move ...
standard output
PASSED
eae41ce2f564ed8c01a314bac5015fd1
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import static java.lang.Math.*; import static java.util.Arrays.*; public class Main { public static void main(Stri...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
3cd2bd4c13f6dec1b8d70f7ae658e6dc
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author bitver */ public class Main { public static void main(String[] args) { InputStream input...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
23e6fa34693899242b8a14a5df9cd97a
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; import java.io.PrintWriter; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int k = in.nextInt(); Boolean[]...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
92346ebefeb892acc138389e225d51db
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.util.HashSet; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(), k = sc.nextInt(); ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
2f1810851d0b51bb999017ce6dc7f289
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Don Li */ public class DiversePermutation { void solve() { int n = in.nextInt(), k = in.nextInt(); int[] res = new int[n]; ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
a13c3b283fa6366a27864f84dae973af
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main { public static InputReader in; public static PrintWriter pw; public static void main(String args[]) { new Thread(null, new Runnable() { public void run() { try{ solve(); ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
6d3438a32d1647eaf6bfcaa329049445
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*; import java.io.*; /** * * @author umang */ public class C483 { public static int mod = 1000000007; public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
5c3e43fb04c839d1221271eef306bc7a
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.math.BigInteger; import java.util.Scanner; import java.io.PrintWriter; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int k = in.nextInt(); Boolean[]...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
a10d28e3325e61bb58e31de3eb1e5c9a
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.util.*; public class CF483C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int k = Integer.p...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
11c3023b75b45f1c828bec84fae569fa
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.awt.Point; import java.io.*; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import javax.lang.model.element.NestingKind; import javax.management.IntrospectionException; import javax.swing.colorchooser.ColorSelectionModel; import javax.swing.text.AbstractDocument.LeafElemen...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
08406306b8f157de18955c7452821ec5
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception{ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String[]input = bufferedReader.readLine().split(" "); int n = ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
8b5529a39ed4e2f0a10bf3473cd0881a
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; public class Diverse_Permutation { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int n = sc.nextInt(); int k = sc.nextInt(); int i = 1; int j = n; int count = k - 1; int turn = 0; while(count >= 0) ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
3f9aaf51c4287643b32051f85ddee6dd
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.util.*; public class div275C { BufferedReader in; PrintWriter ob; StringTokenizer st; public static void main(String[] args) throws IOException { new div275C().run(); } void run() throws IOException { //in=new BufferedReader(new FileReader("input.txt")); in=new BufferedReader(n...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
03ff1ec116c8ef668a13ad6fa5309dd5
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int count=1; System.out.print(1); int temp=1; for(int i=k;i>0;i--){ temp +=i*count; ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
1322621c13dcad635015e03ed8414e79
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Main extends PrintWriter { BufferedReader in; StringTokenizer stok; final Random rand = new Random(31); final int inf = (int) 1e9; final long linf = (long) 1e18; public void solve() throws IOException { ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
a2758c197bc9297e8394aea2eb5590ac
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
30cefb022ef01b4d9ac372a1ed99669e
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.util.*; public class DiversePerm{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); long n,k; n=sc.nextLong(); k=sc.nextLong(); ArrayList<Long> al = new ArrayList<Long>(); long j=1; if(k%2==1){ for(long i=k+1;j<=(k+1)/2;i--,j++){ al.add(j);...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
10999fd891e37fd41db019c1787c7bc4
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.util.*; public class c { private static StringTokenizer st; private static BufferedReader br; public static long MOD = 1000000007; public static void print(Object x) { System.out.println(x + ""); } public static String join(List<?> x, String space) { ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
91fb277dbaf10d1ea50430c1ebf696b3
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; /** * Created by Константин on 24.10.2014. */ public class C { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int first = scanner.nextInt(); int k = scanner.nextInt(); int[] array = new int[first]; int i; ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
c7fb3b2a12416a1554188b723032afd6
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class CF_275C { public static void mai...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
a2e72c213f4ab78d726d0dc8d567b7e3
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.util.*; public class Diverse_Permutation { public static void main(String args[]) { MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int n = sc.nextInt(); int k = sc.nextInt(); int[] a = new int[...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
ea2292fdbd3c740819f67b5370b9ae70
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.util.*; public class C { FastScanner in; PrintWriter out; int i = 0, j = 0; void solve() { /**************START**************/ int n = in.nextInt(), k = in.nextInt(); if (k == 1) { for (i = 1; i <= n; i++) { out.print(i + " "); } out.println(); return; ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
eb2234019581f9528129ca9abb85be03
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Collections.*; import static java.util.Arrays.*; public class CodeforcesRound275Div2ProblemC { static class Problem { Scanner reader; PrintWriter writer; Problem() { reader = new Scanner(Sy...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
ec8ef71902a3425149c0c7187d7c3424
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; public class C275 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int l=1; int a=1; boolean[] b=new boolean[n+1]; StringBuilder ans=n...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
52abbc2748df19476bdc7eddb148236d
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.Writer; ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
dce212b5d9514f82fc6a753df36aa526
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.File; import java.io.FileNotFoundException; import java.util.StringTokenizer; import java.io.Writer; ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
5f781b487ff41c6483ac9c1c298c4033
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; /** * Created by Egor on 24/10/14. */ public class TaskC { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
f4acf47dcae626c04eab2f56e9867b87
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.util.Scanner; /** * Created by hp on 7/29/2017. */ public class toto { static long []fib=new long[80]; static StringBuilder fib_s ; stati...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
3aeca8177c79b469b84c807ef486fa91
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.text.*; public class Main { public static Scanner in = new Scanner(System.in); public static PrintStream out = new PrintStream(System.out); public static BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(System.out)); public static vo...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
6dda775c179e391d803fabaf66fb311e
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; import java.io.PrintWriter; public class DiversePermutation { public static void main(String[] args) { Scanner scan = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = scan.nextInt(); int k = scan.nextInt(); int start = 1; int end = n; int last = 1...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
2235517e42e0ccaf4acdde8bb8950b55
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*; import java.io.*; //267630EY public class Main483C { static PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int[] a=new int[n]; int x=1;...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
b5d5241c0147bd36c6550b1f4e04abe4
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; public class Friends { private static Scanner input = new Scanner(System.in); public static void main(String[] args) { int n = input.nextInt(); int k = input.nextInt(); int[] a = new int[n]; a[0] = ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
b2db29b71c5084d3f284b77c6110c215
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; public final class DiversePermutationCF { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int ans[]=new int[n]; int left=1,right=1+k; int start=0; boolean ok=true; ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
bca16928bbdd1cb3e5a01c0fb4be20b4
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.ObjectInputStream.GetField; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.In...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
2f35cbd5a652621f2051b2b8c0c831a4
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception{ BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String[]input = bufferedReader.readLine().split(" "); int n = Integer.parseInt(input[0]); ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
9f3aaefab5e0848cf9c039fe30753976
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*; import java.math.*; import java.io.PrintStream; import static java.lang.Math.*; public class Task275C { public static Scanner in = new Scanner(System.in); public static PrintStream out = System.out; public static void main(String[] args) { int n = in.nextInt(); int k =...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
072bcef0b9f57cb016d23601512daf77
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*; public class GoodWork { static Scanner in =new Scanner(System.in); public static void main(String[] args) { int n=in.nextInt(); int k=in.nextInt(); for(int i=1;i<=(n+1)/2;i++){ System.out.print(i+" "); k--; if(k==0){ for(int u=...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
bf002447988238e1dd718a3a1b96c10a
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.util.*; public class DiversePermutation { public static InputReader in; public static PrintWriter out; public static final int MOD = (int) (1e9 + 7); public static void main(String[] args) { in = new InputReader(System.in); out = new PrintWriter(Syste...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
0378b75aafe382268f490a2d995516ac
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*;import java.io.*;import java.math.*; public class Main { public static void process()throws IOException { int n=ni(); int k=ni(); int l=1,r=n; for(int i=0;i<k;i++) { if(i%2==0) { p(l+" "); l++; ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
e0e1f9689f1c0edc2b40ad09ea48794f
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class c { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int k = in.nextInt(); int t = n; int s = -1; for (int i = 0; i < k; i++){ out....
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
8778cbe2ce7902169e182749c097ab31
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; public class C483 { public static BufferedReader in; public static PrintWriter out; public st...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
3641ec4a56fc12e2bc92132f66b9870f
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; public class C275 { public static void main(String argsp[]) { Scanner s=new Scanner(System.in); int n=s.nextInt();int k=s.nextInt(); int a[]=new int[n]; for(int i=0;i<n;i+=2) { a[i]=n-i/2; } for(int i=1;i<...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
b85c0b4fd06aad3333b58f878f4055e5
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { static class Reader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} public int read() {if (nu...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
a60ff361997eac8c76355aa653819248
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { InputReader in = new InputReader(System.in); OutputWriter out = new OutputWriter(System.out); int n =in.nextInt(); int k = in.nextInt(); int[] a = new int[n]; for (...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
77d7e65f884140872d4251df45c4510d
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
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.math.BigInteger; import java.util.Arrays; import java.util.HashMap; import java.util.Locale; import java.util.Map; impo...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
d71787aba620267970373e715910f93c
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; public class DiversePermutation { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int largest = n; int smallest = 1; boolean altr = true; StringBuffer ans = ne...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
b1ec1520a6c10f0f566014187000db4d
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
/* @@@@@@@@@@@@@@@@@@@@@@@ * @@@ Doston Akhmedov @@@ * @@@@@@@@@@@@@@@@@@@@@@@ */ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
8943aaa7866b58df5033e37f02b89205
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringTokenizer st1 = new StringTokenizer(br.readL...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
743443d61a9d94efe83996b43dbd8fe2
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.StringTokenizer; public class ProblemC { static Scanner sc = new Scanner...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
0b93cac2b78db2f3bcfc618086a3e3ef
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.StringTokenizer; /** * Created by yujiahao on 7/22/16. */ public class cf_275_c { private FastScanner in; private PrintWriter out; public...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
035e843692263e9871067aeb3eea59d2
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class CF_5 { public static void main(String[] args){ PrintWriter pw = new PrintWriter(System.out, true); Scanner sc = new Scanner(System.in); int n, k, a ,c,d; n = sc.nextInt(); k = sc.nextInt(); int[...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
0b8379e74b3c86e4cb3d789ef7914082
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.*; public class ProC { static int n,k; static int[] aa=new int[100005]; public static void main(String[] args) { Scanner in=new Scanner(System.in); n=in.nextInt();k=in.nextInt(); for(int i=1;i<=k+1;i++) aa[i]=(i%2==1)?(i+1)/2:k-i/2+2; for(int i=k+2;i<=n;i++) aa[i]=i; for(int i=1;i<=...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
d09180f786e3fba3b38defdfe5c745df
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Diverse_Permutation { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in=new Scanner(System.in); int n=in.nextInt(); int k=in.nextInt(); int []permutat...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 8
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
e99d5475310788a29dc2d6e69070b6e2
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class MainC { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int n = sc.nextInt(); int k = sc.nextInt(...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
36d3bf2377d02fb32f2166060d72454f
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Stack; public class Main { public static void main(String[] args) throws IOException { ...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
67fe1355c19a200977d3028812c0bf36
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
//################################################################################################################ import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Unsupported...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
b2746870b9282aaccbc770c20e415753
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader( System.in)); PrintWriter out = new PrintWrite...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
f665ba5498d75cbe391a08fd0b9543a3
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; public class CF275C { public static void main(final String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int m = k / 2; StringBuilder sb = new StringBuilder(); int curr = 1; int last = n...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
b6b16bd58deea77e34475908142bff62
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; /** * Created by sgeisenh on 10/24/14. */ public class Perm { public static void main(String args[]) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int[] A = new int[n]; boolean up = false; for(int i =...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
33a15d48b508c141dde6b99ea2d36ce6
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * * @author Aditya Joshi * SPOJ / CodeChef / Codeforces / HackerRank / Timus / UVA */ public class Main { private static MyScanner sc; private sta...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
424a93675f387319bef52911e9db942e
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public stat...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
0a4843065b8b3e1ee3b4241f599b984b
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * Created on 10/24/14. */ public class CF275C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(Syste...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
c2b4d52f36f615e267fe267e5e6bf815
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String srgs[])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String str[]=br.readLine()...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
603b966841decb11c092193ddb567583
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); int b = 1; while (b <= n) { int f = b; int l = b + k <= n ? b + k : n; whil...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
1cac02f9f8fbf070938c58fb1e34ee07
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public stat...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
99390201f35e3085da8b249c9e32d16c
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class C { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int k = in.nextInt(); int[] A = new int[n]; A[0]...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
f454182796ddb94376fa1aadfaed822c
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.PrintWriter; import java.util.StringTokenizer; /* public class _483C{ } */ public class _483C { private static Pr...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
dd9a9c4b8db5e64c45df84023f1f7c7f
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author bavudaia */ public class Oct24_2 { public sta...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
cd6f56b12c8301c484becb2e869eaba7
train_003.jsonl
1414170000
Permutation p is an ordered set of integers p1,   p2,   ...,   pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1,   p2,   ...,   pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|, ..., |pn - 1 - pn| has e...
256 megabytes
import java.util.Scanner; public class CF275Cd2 { public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int k = scan.nextInt(); int[] result = new int[n]; int first = 1; int last = n; int i=0; if(k%2 == 0 && k != n-1){ r...
Java
["3 2", "3 1", "5 2"]
1 second
["1 3 2", "1 2 3", "1 3 2 4 5"]
NoteBy |x| we denote the absolute value of number x.
Java 6
standard input
[ "constructive algorithms", "implementation" ]
18b3d8f57ecc2b392c7b1708f75a477e
The single line of the input contains two space-separated positive integers n, k (1 ≤ k &lt; n ≤ 105).
1,200
Print n integers forming the permutation. If there are multiple answers, print any of them.
standard output
PASSED
5b86c5aa490123f0d9c24f93ac107a5f
train_003.jsonl
1470323700
Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her with array of non-negative integers a1, a2, ..., an of n elements!Mishka loved the array and she instantly decided to determine its beauty value, but she is too little and can't process large arrays. Right because o...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Map; import java.io.BufferedReader; import ...
Java
["3\n3 7 8\n1\n1 3", "7\n1 2 1 3 3 2 3\n5\n4 7\n4 5\n1 3\n1 7\n1 5"]
3.5 seconds
["0", "0\n3\n1\n3\n2"]
NoteIn the second sample:There is no integers in the segment of the first query, presented even number of times in the segment — the answer is 0.In the second query there is only integer 3 is presented even number of times — the answer is 3.In the third query only integer 1 is written down — the answer is 1.In the four...
Java 8
standard input
[ "data structures" ]
6fe09ae0980bbc59230290c7ac0bc7c3
The first line of the input contains single integer n (1 ≤ n ≤ 1 000 000) — the number of elements in the array. The second line of the input contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — array elements. The third line of the input contains single integer m (1 ≤ m ≤ 1 000 000) — the number of queries. Each of th...
2,100
Print m non-negative integers — the answers for the queries in the order they appear in the input.
standard output
PASSED
362a39e290f1d084c625c46a5e2baf62
train_003.jsonl
1470323700
Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her with array of non-negative integers a1, a2, ..., an of n elements!Mishka loved the array and she instantly decided to determine its beauty value, but she is too little and can't process large arrays. Right because o...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class q1 { public static void main(String[] args) throws Exception { InputReader in=new InputReader(System.in); PrintWriter pw=new PrintWriter(System.out); int n=in.nextInt(); int[] a=new int[n]; int[] prefix=new int[n]; ...
Java
["3\n3 7 8\n1\n1 3", "7\n1 2 1 3 3 2 3\n5\n4 7\n4 5\n1 3\n1 7\n1 5"]
3.5 seconds
["0", "0\n3\n1\n3\n2"]
NoteIn the second sample:There is no integers in the segment of the first query, presented even number of times in the segment — the answer is 0.In the second query there is only integer 3 is presented even number of times — the answer is 3.In the third query only integer 1 is written down — the answer is 1.In the four...
Java 8
standard input
[ "data structures" ]
6fe09ae0980bbc59230290c7ac0bc7c3
The first line of the input contains single integer n (1 ≤ n ≤ 1 000 000) — the number of elements in the array. The second line of the input contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — array elements. The third line of the input contains single integer m (1 ≤ m ≤ 1 000 000) — the number of queries. Each of th...
2,100
Print m non-negative integers — the answers for the queries in the order they appear in the input.
standard output
PASSED
fc8dd473de035e8145f90f8e38fbb1d3
train_003.jsonl
1470323700
Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her with array of non-negative integers a1, a2, ..., an of n elements!Mishka loved the array and she instantly decided to determine its beauty value, but she is too little and can't process large arrays. Right because o...
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.HashMap; import java.util.Map; import java.util.StringTokenizer; public class Mishkaandint...
Java
["3\n3 7 8\n1\n1 3", "7\n1 2 1 3 3 2 3\n5\n4 7\n4 5\n1 3\n1 7\n1 5"]
3.5 seconds
["0", "0\n3\n1\n3\n2"]
NoteIn the second sample:There is no integers in the segment of the first query, presented even number of times in the segment — the answer is 0.In the second query there is only integer 3 is presented even number of times — the answer is 3.In the third query only integer 1 is written down — the answer is 1.In the four...
Java 8
standard input
[ "data structures" ]
6fe09ae0980bbc59230290c7ac0bc7c3
The first line of the input contains single integer n (1 ≤ n ≤ 1 000 000) — the number of elements in the array. The second line of the input contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — array elements. The third line of the input contains single integer m (1 ≤ m ≤ 1 000 000) — the number of queries. Each of th...
2,100
Print m non-negative integers — the answers for the queries in the order they appear in the input.
standard output
PASSED
7476d18cd1bd3ffa8584c46480c9c933
train_003.jsonl
1470323700
Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her with array of non-negative integers a1, a2, ..., an of n elements!Mishka loved the array and she instantly decided to determine its beauty value, but she is too little and can't process large arrays. Right because o...
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.HashMap; import java.util.Map; import java.util.StringTokenizer; public class Mishkaandint...
Java
["3\n3 7 8\n1\n1 3", "7\n1 2 1 3 3 2 3\n5\n4 7\n4 5\n1 3\n1 7\n1 5"]
3.5 seconds
["0", "0\n3\n1\n3\n2"]
NoteIn the second sample:There is no integers in the segment of the first query, presented even number of times in the segment — the answer is 0.In the second query there is only integer 3 is presented even number of times — the answer is 3.In the third query only integer 1 is written down — the answer is 1.In the four...
Java 8
standard input
[ "data structures" ]
6fe09ae0980bbc59230290c7ac0bc7c3
The first line of the input contains single integer n (1 ≤ n ≤ 1 000 000) — the number of elements in the array. The second line of the input contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — array elements. The third line of the input contains single integer m (1 ≤ m ≤ 1 000 000) — the number of queries. Each of th...
2,100
Print m non-negative integers — the answers for the queries in the order they appear in the input.
standard output
PASSED
194f585f19938a6e9d7fc8d3050961cb
train_003.jsonl
1470323700
Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her with array of non-negative integers a1, a2, ..., an of n elements!Mishka loved the array and she instantly decided to determine its beauty value, but she is too little and can't process large arrays. Right because o...
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.HashMap; import java.util.Map; import java.util.StringTokenizer; public class Mishkaandint...
Java
["3\n3 7 8\n1\n1 3", "7\n1 2 1 3 3 2 3\n5\n4 7\n4 5\n1 3\n1 7\n1 5"]
3.5 seconds
["0", "0\n3\n1\n3\n2"]
NoteIn the second sample:There is no integers in the segment of the first query, presented even number of times in the segment — the answer is 0.In the second query there is only integer 3 is presented even number of times — the answer is 3.In the third query only integer 1 is written down — the answer is 1.In the four...
Java 8
standard input
[ "data structures" ]
6fe09ae0980bbc59230290c7ac0bc7c3
The first line of the input contains single integer n (1 ≤ n ≤ 1 000 000) — the number of elements in the array. The second line of the input contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — array elements. The third line of the input contains single integer m (1 ≤ m ≤ 1 000 000) — the number of queries. Each of th...
2,100
Print m non-negative integers — the answers for the queries in the order they appear in the input.
standard output
PASSED
06c16b52e605e5c54ba0aec5e71cfe62
train_003.jsonl
1470323700
Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her with array of non-negative integers a1, a2, ..., an of n elements!Mishka loved the array and she instantly decided to determine its beauty value, but she is too little and can't process large arrays. Right because o...
256 megabytes
import java.io.*; import java.util.*; public class Program { static BufferedReader in; static PrintWriter out; static StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args) throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintW...
Java
["3\n3 7 8\n1\n1 3", "7\n1 2 1 3 3 2 3\n5\n4 7\n4 5\n1 3\n1 7\n1 5"]
3.5 seconds
["0", "0\n3\n1\n3\n2"]
NoteIn the second sample:There is no integers in the segment of the first query, presented even number of times in the segment — the answer is 0.In the second query there is only integer 3 is presented even number of times — the answer is 3.In the third query only integer 1 is written down — the answer is 1.In the four...
Java 8
standard input
[ "data structures" ]
6fe09ae0980bbc59230290c7ac0bc7c3
The first line of the input contains single integer n (1 ≤ n ≤ 1 000 000) — the number of elements in the array. The second line of the input contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — array elements. The third line of the input contains single integer m (1 ≤ m ≤ 1 000 000) — the number of queries. Each of th...
2,100
Print m non-negative integers — the answers for the queries in the order they appear in the input.
standard output
PASSED
c67889eaccbabeb4a71c5a746b59841b
train_003.jsonl
1470323700
Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her with array of non-negative integers a1, a2, ..., an of n elements!Mishka loved the array and she instantly decided to determine its beauty value, but she is too little and can't process large arrays. Right because o...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Bit...
Java
["3\n3 7 8\n1\n1 3", "7\n1 2 1 3 3 2 3\n5\n4 7\n4 5\n1 3\n1 7\n1 5"]
3.5 seconds
["0", "0\n3\n1\n3\n2"]
NoteIn the second sample:There is no integers in the segment of the first query, presented even number of times in the segment — the answer is 0.In the second query there is only integer 3 is presented even number of times — the answer is 3.In the third query only integer 1 is written down — the answer is 1.In the four...
Java 8
standard input
[ "data structures" ]
6fe09ae0980bbc59230290c7ac0bc7c3
The first line of the input contains single integer n (1 ≤ n ≤ 1 000 000) — the number of elements in the array. The second line of the input contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — array elements. The third line of the input contains single integer m (1 ≤ m ≤ 1 000 000) — the number of queries. Each of th...
2,100
Print m non-negative integers — the answers for the queries in the order they appear in the input.
standard output