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
d412a577b5e002c35bc7cd79c017741e
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt() ; int ans = 0 ; String []cur = new String[n]; for(int i = 0 ; i < n ; i++){ cur[i] = sc.next() ; } ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 6
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
1f668763e7ac120c4670378ec32fed59
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt() ; int ans = 0 ; String []cur = new String[n]; for(int i = 0 ; i < n ; i++){ cur[i] = sc.next() ; } ...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 6
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
882c5c43189099e1933b040a18ad8cc2
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); // int[] tn = new int[n]; String s = in.next(); char c=s.charAt(1); int cmp=1; for (int i = 1; i < n; i++) { s=in.next(); if(s.c...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 6
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
c22e34bbe8360a50a21d7adfbcc92fac
train_002.jsonl
1379172600
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class codeforce { public static void main(String[] args) { int num,count=0,c=1; Scanner obj= new Scanner(System.in); num=obj.nextInt(); int arr[]=new int[num+1]; arr[0]=0; for(int i=1;i<=num;i++) { ar...
Java
["6\n10\n10\n10\n01\n10\n10", "4\n01\n01\n10\n10"]
1 second
["3", "2"]
NoteThe first testcase corresponds to the figure. The testcase has three groups consisting of three, one and two magnets.The second testcase has two groups, each consisting of two magnets.
Java 6
standard input
[ "implementation" ]
6c52df7ea24671102e4c0eee19dc6bba
The first line of the input contains an integer n (1 ≤ n ≤ 100000) — the number of magnets. Then n lines follow. The i-th line (1 ≤ i ≤ n) contains either characters "01", if Mike put the i-th magnet in the "plus-minus" position, or characters "10", if Mike put the magnet in the "minus-plus" position.
800
On the single line of the output print the number of groups of magnets.
standard output
PASSED
c5fbd86c4af03f66bb8191f2032f6c92
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.TreeSet; public class B { public static void main(String[] args) throws IOException { FastScanner scan = new FastScanner(); PrintWriter out ...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
ad6fe1bd06d87f481637ed37ef78dd63
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.*; import java.util.*; public class B { public static void solution(BufferedReader reader, PrintWriter out) throws IOException { In in = new In(reader); int n = in.nextInt(); int[] a = new int[n]; boolean[] used1 = new boolean[100001]; for (int i =...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
e3b832dc809e59b9f89f8feed71061fe
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class Inventory2 { static int[] dictionary = new int[100001]; static ArrayList<Integer> differences(int[] a, int[] b, int n) { ArrayList<In...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
3a8ea72dfbc7dc0ca9e40ed7c6433f86
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.StringTokenizer; public class Main { static class FastScanner { BufferedReader reader; StringToke...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
ebccfc8c72302268acbb51776c4bf1b2
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.util.ArrayList; import java.util.HashMap; import java.util.Scanner; public class B569 { public static void main(String[] args) { // TODO Auto-generated method stub. Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[] list = new int[n]; ...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
25711a47fa0919e1c11a79df57ab6a5f
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class MainA { public static void main(String[] args) throws IOException { new MainA().solve(); } PrintWriter out; boolean[] u; ArrayList<Integer>[] g; int cnt = 0; int ind = 0; int n; int[] a = new ...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
e0f141f158caec5c5cb559fd52e8ca7d
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; @SuppressWarnings("unchecked") public class P596B { class Pair { int v, i; public Pair(int v, int i) { this.v = v; this.i = i; } @Override public String toString() { return Integer.toString(v...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
65e7d4cb19e257969ae7e8fd30bf4d74
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
// 569B - Inventory // http://codeforces.com/contest/569/problem/B // Farwa Naqi import java.util.*; import java.lang.*; import java.io.*; public class Inventory569B { public static void main (String[] args) throws java.lang.Exception { // Input Scanner sc = new Scanner(System.in); int n = sc.nextInt(); in...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
f1886c291b12c680f51c62d9ae250905
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.util.ArrayList; import java.util.BitSet; import java.util.List; import java.util.Scanner; import java.util.Set; public class Code569B { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int[] a = new int[n]; BitSet used = new BitSet(n...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
7dadb8a21c326fda410e8d0cdb4edf9d
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.Set; public class Code569B { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int[] a = new int[n]; int[] dp = new int[(int) (Math.pow(10, 5) + 1)]; ...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
189163716a820e50ca73453710bbedf2
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import javafx.util.Pair; import java.awt.geom.Line2D; import java.io.*; import java.util.*; public class Main { private final static InputReader ir = new InputReader(System.in); private final static OutputWriter ow = new OutputWriter(System.out); private final static int INF = Integer.MAX_VALUE; priva...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
b6fed5d24f6eba124b854c5c47dfb389
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
//package codeforces; import java.io.IOException; import java.util.*; public class B569 { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] arr = new int[n]; HashMap<Integer, Integer> map1 = new HashMap<>();...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
2b09ed79273ec65e4b4f13c8edbaed97
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.awt.Point; import java.awt.geom.Line2D; import java.io.BufferedReader; import java.io.File; import java.io.OutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.security.GuardedObject; import java.util.ArrayList; import java.util.Arrays; import ...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
b891394a496e1ad5cc9b45290366f8db
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.*; import java.util.*; public class B { private static final long modulo = 1000000007; // private static void solve() { int N = in.nextInt(); int a[] = new int[N]; Set<Integer> hasSet = new HashSet<>(); Set<Integer> wasSet = new HashSet<>(); Queue<I...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
99b430fa6b5d21bc06086e46f4a2e113
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; public class CodeForce { static boolean flag=false; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = n...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
2e60997c3806a53bf8b72712e7a48411
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; public class Inventory { public static void main(String[] args) throws Exception{ BufferedReader inp = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(inp.readLine()); ...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
5e44e096b565e2b160eaf3ebebbb1612
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.awt.event.ComponentAdapter; import java.io.*; import java.util.*; import java.util.Arrays; import java.util.function.Consumer; import java.util.function.Predicate; public class Main { static MyScanner in; static PrintWriter out; //static Timer t = new Timer(); public static void main(Stri...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
0829f94bff8c905a9859f4f28b482bcd
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.util.HashSet; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class C { public static Scanner scan = new Scanner(System.in); public static void solve () { int n=scan.nextInt(); int[] a= new int[n]; HashSet<Integer> h= new HashSet<Integer>(); for(int...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
32d277bf44df5de9ca6fc28ec3463972
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Second { //static long m=1000000007; /*public static long gcd(long x,long y) { if(x%y==0) return y; else return gcd(y,x%y); }*/ public static int prime(int n) { int...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
c4f542c2b4c77f8d968e4b60722a2757
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.util.*; public class inventory { public static void main(String args[]) { Scanner in=new Scanner(System.in); int n=in.nextInt(); int a[]=new int[n+1]; int b[]=new int[n+1]; //int c[]=new int[n+1]; int ind[]=new int[n+1]; int i,j,k=1,min,pos=-1;...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
85775c3afc8145b98b645bebe318e25b
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[]a=new int[n]; int []b=new int[n]; Arrays.fill(b,0); TreeSet<Integer> ts=new TreeSet<Intege...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
4f4894420e83c71069d9ede13b59216e
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.util.*; public class Inventory { private static Scanner sc; public static void main(String[] args) { sc = new Scanner(System.in); int n = sc.nextInt(); int [] array = new int [n]; int [] check = new int [n]; int x; for(int i = 0; i < n; i++) { x = sc.nextInt(); if( x > n) x = 1;...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
8d852281cde102da8c2cf43f5d4b7308
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import javafx.util.Pair; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.*; public class Main { public static Scanner scanner; public static List<Integer> labels = new ArrayList<>(); public static List<Integer> unusedIndexes = new ArrayList<>(); public static boo...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
4068c39d51ab0b048b8f58393f903681
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.HashSet; import java.util.InputMismatchException; import java.util.TreeSet; /** * Created by Shreyans Sheth [bholagabbar] on 8/10/2015 at 9:53 PM using IntelliJ IDEA (Fast IO Template) */ public class B { public static void main(String[] args) throw...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
d3d872ec2f998494ec3c94e6b3c5c7d3
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int size = in.nextInt(); boolean[] can_use_SN = new boolean[size + 1]; int[] SN = new int[size]; boolean[] need_to_renumber = new boolean[size]; ...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
3fa57014f42872eb7c5266a58191caab
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.util.HashSet; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); HashSet<Integer> numbers_to_use = new HashSet<>(); int size = in.nextInt(); for (int i = 1; i <= size; i++) { number...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
1517b951c5e59ff0548a32cb28e95a24
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class Inventory { public static void main(String[] args) { // TODO Auto-generated method stub Scanner t = new Scanner(System.in); int n = t.nextInt(); int[] a = new int[n]; HashMap<Integer, Integer> map = new HashMap<>(); int step = 1; for (in...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
fc61d405b9f91388adb393da6165b32d
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.util.*; import java.io.*; public class Main implements Runnable { public void solve() throws IOException { int n = nextInt(); int[] a = new int[n]; for(int i = 0; i < n; i++) a[i] = nextInt(); boolean[] used = new boolean...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
1f13c43a3cce77566e711f6e2a8a63e2
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
/** * Created by brzezinsky on 08/06/15. */ import java.io.*; import java.math.BigInteger; import java.util.*; public class Solution extends Thread{ public Solution(String inputFileName, String outputFileName) { try { if (inputFileName != null) { this.input = new BufferedReade...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
2dca3b321a8fd79c8a6dcd1b4f93f4e7
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputStream inputStream = System.in; OutputStream outputStream = System.out; // InputStream inputStream = new FileInputStream(new File("stars.in")); // OutputStream ou...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
483ef108a5b80990bc1f20b4055b0169
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class CF569B { public static void main(String[] args) { InputReader cin = new InputReader(System.in); PrintWriter cout = new PrintWriter(System.out); Solution sol = new Solution(); sol.solve(cin, cout); cout.flush();...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
25e610189578ac00b05774bc9f72edfe
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class CF569B { public static void main(String[] args) { InputReader cin = new InputReader(System.in); int n = cin.nextInt(); int[] a = new int[n]; int[] c = new int[n]; boolean[] b = new boolean[100005]; for ...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
554deb7d719bc35753592f54968f3a97
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
256 megabytes
import java.util.*; import java.io.*; public class marte{ private int contor=0; private int raspuns=0; public static void main (String args[]) throws Exception{ Scanner input=new Scanner(System.in); HashMap<String, String> map1= new HashMap<String, String>(); HashMap<String, Integer> map2= new HashMap<String, In...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
aeb30b7c35c2649ac64a581b7598864c
train_002.jsonl
1439224200
Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numbers and keep the track of everything.During an audit, you were surprised to find out that the i...
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.Writer; import java.util.ArrayList; import java.util.InputMismatchException; public final class Main { public static vo...
Java
["3\n1 3 2", "4\n2 2 3 3", "1\n2"]
1 second
["1 3 2", "2 1 3 4", "1"]
NoteIn the first test the numeration is already a permutation, so there is no need to change anything.In the second test there are two pairs of equal numbers, in each pair you need to replace one number.In the third test you need to replace 2 by 1, as the numbering should start from one.
Java 8
standard input
[ "greedy", "math" ]
1cfd0e6504bba7db9ec79e2f243b99b4
The first line contains a single integer n — the number of items (1 ≤ n ≤ 105). The second line contains n numbers a1, a2, ..., an (1 ≤ ai ≤ 105) — the initial inventory numbers of the items.
1,200
Print n numbers — the final inventory numbers of the items in the order they occur in the input. If there are multiple possible answers, you may print any of them.
standard output
PASSED
a9844cf8c1263a70d20b0f527e023a58
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.util.Scanner; public class RGB{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for (int j = 0 ; j < q ; j ++){ int n = sc.nextInt(); int k = sc.nextInt(); int[] R = new int[n]; int[] s_r = new int[n]; int[] G = new int[n];int[] s_g = new in...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
85987c867d193c18a9b115416bad15cf
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.util.Scanner; public class RGB{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for (int j = 0 ; j < q ; j ++){ int n = sc.nextInt(); int k = sc.nextInt(); int[] R = new int[n]; int[] s_r = new int[n]; int[] G = new int[n];int[] s_g = new in...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
2cb77ce7ae850658966f209eadd5eff3
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.*; import java.util.*; public class D1_RGBSubstring { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader inp = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream);...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
7ba7f2cce4d1c854318bb5f09b93e1ac
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class D1 { public static void main(String[] args) { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); char[] sub = {'R','G','B'}; int T = in.nextInt(); for(int tt=0;tt<T;tt++) { int n = in.nextInt(), k = in.ne...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
73daee61716a3df2e0585e493bc568bf
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.OutputStreamWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static int[] arr = new int[200005]; public static void main(String[] args) throws IOException{ Buffered...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
f2e1eb3f3f6154e14911d09cf056aa64
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class RGBS { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
7973768dbacb747f119c55979b767e0b
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class RGBS { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
5ad8f2dc2e06e9b1c4eaf58e31014ecd
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; public class RGBS { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new ...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
c9107e9d09c51f0f139a17e3522cbfd3
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.*; import java.util.*; public class a { public static void main(String[] args) { new a(); } FS in = new FS(); PrintWriter out = new PrintWriter(System.out); int q; int n, k; int[][] diff, cs; char[] str, p = {'R', 'G', 'B'}; a() { q = in.nextInt(); while (q-- > 0) { n = in.nextInt(); ...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
aa8d0d8a83b16f5c66db90a99d059c00
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
/* 9 2 1 1 1 1 1 0 0 0 0 1 2 1 5 5 6 5 7 2 3 2 4 3 8 3 9 */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class Question { static long[] ar...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
3649c9735fd9abc64b3174839e0a67eb
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; public class DIV_3_575 { static Reader r = new Reader(); static PrintWriter out = new PrintWriter(System.out); private static void solve1() throws IOException { i...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
e3d71a3bd0c2361ab783818cb9a3b58a
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; public class DIV_3_575 { static Reader r = new Reader(); static PrintWriter out = new PrintWriter(System.out); private static void solve1() throws IOException { i...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
0ccec2c728b5afe566cab8da453d74cc
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class ProblemD { public static InputStream inputStream = System.in; public static OutputStream outputStream = System.out; public static void main(String[] args) { MyScanner scanner = new MyScanner(inputStream); PrintWriter out = ...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
3227ca2e24002f126ab2f637c3cb8036
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; public class Main { private static final String NO = "NO"; private static fina...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
175479158761d533547d234edf2ac5b2
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Test { FastIO sc; int n; int[] dp; int M = 1000000007; void solve() throws Exception { int t = sc.nextInt(); while (t-- != 0) { StringBuilder s = new StringBuilder(); s.append...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
92494475a3e0b57a2698a63f9a3fbeb5
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Test { FastIO sc; int n; int[] dp; int M = 1000000007; void solve() throws Exception { int t = sc.nextInt(); while (t-- != 0) { int n = sc.nextInt(), k = sc.nextInt(); char[]...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
9dc754f010bcb33c3b8898e7314c3404
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class RGBSubstring { public static void main(String[] args) { FastReader input=new FastReader(); int t=input.nextInt(); while(t-->0) { St...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
941569924bcd198d51617821b366f7ea
train_002.jsonl
1563978900
The only difference between easy and hard versions is the size of the input.You are given a string $$$s$$$ consisting of $$$n$$$ characters, each character is 'R', 'G' or 'B'.You are also given an integer $$$k$$$. Your task is to change the minimum number of characters in the initial string $$$s$$$ so that after the ch...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int q = sc.nextInt(); for (int query = 0; query < q; query++) { int n = sc.nextInt(); int k = sc.nextInt(); String s = sc.next(); long maxsymb = 0; long[] symb = new long[3...
Java
["3\n5 2\nBGGGG\n5 3\nRBRGR\n5 5\nBBBRR"]
2 seconds
["1\n0\n3"]
NoteIn the first example, you can change the first character to 'R' and obtain the substring "RG", or change the second character to 'R' and obtain "BR", or change the third, fourth or fifth character to 'B' and obtain "GB".In the second example, the substring is "BRG".
Java 8
standard input
[ "implementation" ]
1aa8f887eb3b09decb223c71b40bb25b
The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2000$$$) — the number of queries. Then $$$q$$$ queries follow. The first line of the query contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2000$$$) — the length of the string $$$s$$$ and the length of the substring. The second line...
1,500
For each query print one integer — the minimum number of characters you need to change in the initial string $$$s$$$ so that after changing there will be a substring of length $$$k$$$ in $$$s$$$ that is also a substring of the infinite string "RGBRGBRGB ...".
standard output
PASSED
a69189a4c9870c370bc03b4576c27b4e
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.util.Scanner; /** * Created by drproduck on 2/22/17. */ public class D { public static void main(String[] args) { Scanner in = new Scanner(System.in); int k = in.nextInt(); int q = in.nextInt(); double[] dp = new double[k + 1]; int[] res = new int[1001]; ...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
bc301254e402dcba074609e82b0ddea8
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
//Codeforces Round 399 import java.io.*; import java.util.*; public class TaskD { public static void main (String[] args) throws IOException { FastScanner fs = new FastScanner(System.in); PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out)); int k = fs.nextInt(); int q = fs.nextInt(...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
87e14bc3d5ba07f7f1f9839d6ba33f5e
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
328e679d87b6dd49c5f04d8dcf4aab6f
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
f91877aa155db516864641eafae1e2ce
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
//package Round_399; import java.io.PrintWriter; import java.util.Scanner; public class D { public D() { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int k = sc.nextInt(); int q = sc.nextInt(); double[] dp = new double[1004]; int[] ans = new int[1004]; dp[0] = 1....
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
e6d2037d1322830a23c888f5f037c4b5
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.util.TreeSet; public class D { public static void main(String[] args) throws IOException { FastScanner scan = new FastScann...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
2476e189365887e051f1a1cb4c47ad6e
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.Arrays; import java.util.StringTokenizer; public class D { public static void main(String[] ar...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
35a328c3b3a2646d86480d695e6fb700
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.*; import java.util.*; public class D { public static void solution(BufferedReader reader, PrintWriter writer) throws IOException { In in = new In(reader); Out out = new Out(writer); int k = in.nextInt(), q = in.nextInt(); double EPS = 1e-7; double...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
a3ba91dc1e6d4fa90932a799afecc2b1
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); int k = scan.nextInt(); int q = scan.nextInt(); double[] dp = new double[1004]; int[] answer = new int[1004]; dp[0] = 1.; int d = 1; double epsilon = 0.000000...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
ae131bd664df1733b736fa4e5d60150b
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.PrintWriter; public class D_399 { public static int mod = 1000000007; static FastReader scan = new FastReader(); static PrintWriter out = new PrintWriter(System.out); public static void main(String args[]...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
5edebac02aeb6384d2e7b244d14a8407
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.util.*; public class Main { public static void main(String[] args) throws Exception { new Main().solve(); } int inf = 2000000000; int mod = 1000000007; double eps = 0.00...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
208c5d56e270f73067032292a4806336
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.*; import java.util.*; import java.util.Map.Entry; public class TestClass { private static InputStream stream; private static byte[] buf = new byte[1024]; private static int curChar; private static int numChars; p...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
6e559d68ff9d7816f03ca2fd4174116e
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
// // John.java // Created by Alister Estrada Cueto on 9/25/18. import java.util.*; public class John{ public static void main(String [] args){ Scanner sc = new Scanner(System.in); int k = sc.nextInt(); int q = sc.nextInt(); int[] p = new int[q]; long eps = 1/10000000; int n = 1004; for (int i = 0...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
4bc5ac1004bdbf64a5e0e2301f321d27
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; public class Main2 { static long mod = 1000000007L; public static void main(String[] args) { FastScanner scanner = new FastScanner...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
eacac43183b51478295b757c9695bd3b
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.InputStream; /** * Built using CHelper p...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
2d48792b2fdd7bbc56549e88e500c5db
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcept...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
5755599e6cbe54b93be16eff88f0779b
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.util.*; public class Ejercicio3{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int k = sc.nextInt(); int q = sc.nextInt(); int[] queries = new int[q]; for(int i=0; i<q; i++){ sc.nextLine(); queries[i]=sc.nextInt(); } /*int k ...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
9583ed5c75acbe9818b1fc6bd04e764c
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.*; import java.util.*; public class D { BufferedReader in; StringTokenizer st; PrintWriter out; String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine()); return st.nextToken(); } int nextInt() throws Exception { return Integer...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
1dc8e2f650587c2b5fb9022121497b9c
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
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 JonOrbs { int N = 1005; double eps = 1e-7; void solve() { int k = in.nextInt(), q = in.nextInt(...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
c69d737bc9d4a5fad0636b1d6b249565
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.*; import java.util.*; public final class TaskD { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(in, out); solver.solve(); in.close(); out.flush()...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
5ed2f4e27105adc0b0e06fc49c2701b0
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.*; import java.util.*; public final class TaskD { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(in, out); solver.solve(); in.close(); out.flush()...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
0fa4c3cdef890fea42af087a8671a15e
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.*; import java.util.*; public final class TaskD { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(in, out); solver.solve(); in.close(); out.flush()...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
67a3153cd26699668e24defa058c86f3
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.*; import java.util.*; public final class TaskD { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(in, out); solver.solve(); in.close(); out.flush()...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
f3f5a538608179df00faf51c28112c42
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.util.*; import java.io.*; /** * * @author umang */ public class ProblemD { public static int mod = (int) (1e9+7); public static int mod1 = (int) (1e9+6); public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter out = new...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
d1368d226ba7bb35133e390166dc6cb7
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.util.*; public class jonOrbs{ public static void main(String [] args){ Scanner sc = new Scanner(System.in); int k = sc.nextInt(); int q = sc.nextInt(); int[] p = new int[q]; long eps = 1/10000000; int n = 1004; for (int i = 0;i < q ;i++ ) { p[i] = sc.nextInt(); } double[] prob = new ...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
b74e8b8943cd5f16ae608a8736ed8ab8
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class D { static StringTokenizer st; static BufferedReader br; static PrintWriter pw; ...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
340e8dbad0173b59750e6b4e50bc5d6a
train_002.jsonl
1487606700
Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are k different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall. The probability of this orb being of any kind is equal. As the north of wall is full of dangers, he...
256 megabytes
//import java.util.Scanner; // // //public class JonandOrbs { // // public static void main(String[] args) { // Scanner in = new Scanner(System.in); // int n = in.nextInt(), q = in.nextInt(); // double t1[] = new double[n+1], t2[] = new double[n+1]; // double probs[] = new double[100000]; // t1[0] = 1; // for(in...
Java
["1 1\n1", "2 2\n1\n2"]
2 seconds
["1", "2\n2"]
null
Java 8
standard input
[ "dp", "probabilities", "math" ]
a2b71d66ea1fdc3249e37be3ab0e67ef
First line consists of two space separated integers k, q (1 ≤ k, q ≤ 1000) — number of different kinds of orbs and number of queries respectively. Each of the next q lines contain a single integer pi (1 ≤ pi ≤ 1000) — i-th query.
2,200
Output q lines. On i-th of them output single integer — answer for i-th query.
standard output
PASSED
4fcadc5bd68e09d45bbe1f177ee8ea95
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.HashMap; import java.util.Random; import java.util.TreeSet; import java.io.BufferedOutputStream; import java.util.StringTokenizer; import java.util.Map; import java.util.NoSuchElementException;...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 8
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
0731fcb0c82b898a632ab87378333377
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.util.*; public class P074D { private static class BIT { private final int N; private int[] tree; public BIT(int N) { this.N = N; tree = new int[N + 1]; } private void set(int x, int v) { while (x <= N) { ...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
b23fad386fa2797cd13e907eb334da5b
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; import static java.lang.Math.*; public class Main implements Runnable { StringTokenizer tokenizer = new StringTokenizer(""); BufferedReader in; PrintStream out; public void debug(String s) { System.out.println(s); } public static void main(S...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
bf0bf9a1017b98cd6a39200d0f3c2f40
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Comparator; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Random; /** * Generated by Contest helper plug-in * Actual solution is at the bottom */ public class Main { public ...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
3b708e2e9a45d62469e75202c9a1d69e
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.util.NavigableSet; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Random; import java.io.*; import java.util.Comparator; import java.util.TreeSet; import java.util.Arrays; /** * Generated by Contest helper plug-in * Actual solution is at the bottom */ public class Ma...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
9b343ccba76717484be64fee5fe38090
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; /** * Generated by Contest helper plug-in * Actual solution is at the bottom */ public class Main { public static void main(String[] args) { InputReader in = new StreamInputReader(System.in); ...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
8bbe7615562923be14138a793751c955
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; /** * Generated by Contest helper plug-in * Actual solution is at the bottom */ public class Main { public static void main(String[] args) { InputReader in = new StreamInputReader(System.in); ...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
8b56382098bac6aa8eb5e3f064413b3c
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.util.NavigableSet; import java.util.InputMismatchException; import java.util.Random; import java.util.TreeSet; import java.io.*; import java.util.Arrays; import java.util.HashMap; /** * Generated by Contest helper plug-in * Actual solution is at the bottom */ public class Main { public static void m...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
eeae67bcf7cd8cff7bfb469cac15d5fb
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.util.Map; import java.util.Collections; import java.util.HashMap; import java.util.InputMismatchException; import java.math.BigInteger; import java.util.*; import java.util.Collection; import java.util.ArrayList; import java.util.List; import java.util.TreeMap; import java.util.Comparator; import java.io.*;...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
3b928170b6f969e2399158cf1dd449b8
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.util.Map; import java.util.Collections; import java.util.HashMap; import java.util.InputMismatchException; import java.math.BigInteger; import java.util.*; import java.util.Collection; import java.util.ArrayList; import java.util.List; import java.util.TreeMap; import java.util.Comparator; import java.io.*;...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
188c8b12b9ad359b3836112d907f8324
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.HashMap; import java.util.TreeMap; import java.util.TreeSet; public class Hanger { class Segment implements...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
8d49d19d5c9cafc7eeff73d9ccf61c16
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.HashMap; import java.util.TreeMap; import java.util.TreeSet; public class Hanger { class Segment implement...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
d71ba7c1c270c8c5325744ff37d83abd
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.HashMap; import java.util.TreeMap; import java.util.TreeSet; public class Hanger { class Segment implement...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
84d0811f52a40630552e894163434e0b
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.Arrays; import java.util.HashMap; import java.util.TreeSet; public class D68 { static StreamTokenizer in; static PrintWriter out; s...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
03220614114d1e4ecc145b8a47826d9e
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class D implements Runnable { static class Segment { int l; int r; public Segment(int l, int r) { super(); this.l = l; this.r = r; } @Override public String toString() { return "Segment [l=" + l + ", r=" + r + "]"; } } s...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
f494bb5394e7a4511549a8df67216463
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
import java.io.*; import java.util.*; public class D { int n; int[] qMan, qLeft, qRight; int[] x; int queries; int getIndex(int i) { int l = 0, r = x.length; while (r - l > 1) { int m = (r + l) / 2; if (x[m] > i) { r = m; } else { l = m; } } return l; } private void solve() throws...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output
PASSED
d276693f39e0587759807faa3d2a4789
train_002.jsonl
1302879600
In one very large and very respectable company there is a cloakroom with a coat hanger. It is represented by n hooks, positioned in a row. The hooks are numbered with positive integers from 1 to n from the left to the right.The company workers have a very complicated work schedule. At the beginning of a work day all th...
256 megabytes
//package round68; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; ...
Java
["9 11\n1\n2\n0 5 8\n1\n1\n3\n0 3 8\n9\n0 6 9\n6\n0 1 9"]
4 seconds
["2\n3\n2\n5"]
null
Java 6
standard input
[ "data structures" ]
1250f103aa5fd1ac300a8a71b816b3e4
The first line contains two integers n, q (1 ≤ n ≤ 109, 1 ≤ q ≤ 105), which are the number of hooks on the hanger and the number of requests correspondingly. Then follow q lines with requests, sorted according to time. The request of the type "0 i j" (1 ≤ i ≤ j ≤ n) — is the director's request. The input data has at le...
2,400
For each director's request in the input data print a single number on a single line — the number of coats hanging on the hooks from the i-th one to the j-th one inclusive.
standard output