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
47f48fae90016cb3711820172e1eafa4
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class SolutionB { public static void main(String[] args){ new SolutionB().run(); } int next[]; int a[]; int cur[]; int arr[]; int sz = 0; void solve(){ int n = in.nextInt(); a = new int[n]; for(int i = 0; i < n; i++) a[i] = in.nextI...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
3a2fd675f907c98160876d059f2a06ad
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class SolutionB { public static void main(String[] args){ new SolutionB().run(); } int next[]; int a[]; int cur[]; ArrayList<Integer> arr; void solve(){ int n = in.nextInt(); a = new int[n]; for(int i = 0; i < n; i++) a[i] = in.nextI...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
2cc73236b05b8c35b8b37a88187871db
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.TreeSet; public class Vessels { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); final int n = Integer.parseInt(br.readLine()); ...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
a1978bbb7a0fd2357cf6ec060e3ca1f8
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Vessels { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
5cd42d4af184acf1783d4167a5a7c68b
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.*; import java.util.*; public class CF { TreeSet<Integer> free = new TreeSet<>(); int[] now; int[] a; int n; void go(int v, int cnt) { Integer x = free.higher(v - 1); if (x == null) { return; } v = x; int can = Math.min(cnt, a[v] - now[v]); cnt -= can; now[v] += can; if (now[v]...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
6a92893db4b95f2f38ac6370b9fbd27b
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.*; import java.util.*; public class cf371d { static FastIO in = new FastIO(), out = in; public static void main(String[] args) { int n = in.nextInt(); DisjointSet ds = new DisjointSet(n+1); int[] v = new int[n]; int[] cap = new int[n]; for(int i=0; i<n; i++) cap[i] = in.nextInt(...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
b021f1631cf77de2f4c2e3b2d9fa1df2
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.TreeSet; public class D_Vessels { private static void addWater(int vessel , int amount) { vessels[vessel] += amount; if (vessels[vessel] > caps[vessel]) { amount = vessels[vessel] - caps[vessel]; ...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
f74b894e560eec276109cdc87650367b
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.*; import java.util.*; public class D371{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); int n = Integer.parseInt(br.readLine()); StringTokenizer st = new St...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
c8873692cd6293140379ccf8a49665ac
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; import java.util.TreeSet; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Aleksandr */ public class Main { static int[] currentWater; // static ArrayList<Integer> notFull = new ArrayLis...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
970ca32150fc1828408cdbd5fe7c28bb
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Codeforces { public static void main(String[] args) { CustomInputReader in = new CustomInputReader(System.in); Task solver = new Ta...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
98b7459ed1c5d0462a715b652f3808ff
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Main implements Runnable { // leave empty to read from stdin/stdout private static final String TASK_NAME_FOR_IO = ""; // file names private static final String FILE_IN = TASK_NAME_FOR_IO + ".in"; private static final...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
2c8ee2ea57e07ae0594c46c17b99d2c5
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class D { static StringTokenizer st; static BufferedR...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
d9b4b2b222cb59c789f22cbe940be918
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public stat...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
67c7d5a5ae797200919d96c9cbbf737d
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class D { public static void main(String args[]) throws Exception{ int n = readInt(); int[] pointTo = new int[n+1]; int[] capacity = new int[n+1]; int[] startCap = new int[n+1];...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
7a9b45a883468f8b22f9d3d6b78190b3
train_002.jsonl
1386493200
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of the i-th vessel is ai liters. Initially, all the vessels are empty. In some vessels water is poured. All the water that ...
256 megabytes
import java.util.*; import java.io.*; public class D { public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st= null; static String nx() throws Exception { for (;st == null || ! st.hasMoreTokens();){ String k1 = in.readLine(...
Java
["2\n5 10\n6\n1 1 4\n2 1\n1 2 5\n1 1 4\n2 1\n2 2", "3\n5 10 8\n6\n1 1 12\n2 2\n1 1 6\n1 3 2\n2 2\n2 3"]
2 seconds
["4\n5\n8", "7\n10\n5"]
null
Java 7
standard input
[ "data structures", "dsu", "implementation", "trees" ]
37e2bb1c7caeeae7f8a7c837a2b390c9
The first line contains integer n — the number of vessels (1 ≤ n ≤ 2·105). The second line contains n integers a1, a2, ..., an — the vessels' capacities (1 ≤ ai ≤ 109). The vessels' capacities do not necessarily increase from the top vessels to the bottom ones (see the second sample). The third line contains integer m ...
1,800
For each query, print on a single line the number of liters of water in the corresponding vessel.
standard output
PASSED
9faa2b33176560af356be17f3a11452b
train_002.jsonl
1406907000
Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the princess ignored her and sent her to Ponyville to check on the preparations for the celebration. Twi...
256 megabytes
import java.io.*; import java.util.*; public class Main { static ArrayList<Integer>[] adj; static int[] degree; static boolean[] marked; static ArrayList<Integer> path; public static void main(String[] args) { BufferedReader br = new BufferedReader( new InputStreamReader( System.in) , 8* 1024); Scanner...
Java
["3 2\n1 2\n2 3\n1 1 1", "5 7\n1 2\n1 3\n1 4\n1 5\n3 4\n3 5\n4 5\n0 1 0 1 0", "2 0\n0 0"]
1 second
["3\n1 2 3", "10\n2 1 3 4 5 4 5 4 3 1", "0"]
null
Java 7
standard input
[ "dfs and similar" ]
203be1bbb9bb3648aaa63e81ec2a9db5
The first line contains two integers n and m (2 ≤ n ≤ 105; 0 ≤ m ≤ 105) — the number of places and the number of roads in Ponyville. Each of the following m lines contains two integers ui, vi (1 ≤ ui, vi ≤ n; ui ≠ vi), these integers describe a road between places ui and vi. The next line contains n integers: x1, x2, ....
2,200
Output the number of visited places k in the first line (0 ≤ k ≤ 4n). Then output k integers — the numbers of places in the order of path. If xi = 0, then the i-th place must appear in the path even number of times, else i-th place must appear in the path odd number of times. Note, that given road system has no self-lo...
standard output
PASSED
d4e33ff7257174ae1dd4c347385a46b3
train_002.jsonl
1406907000
Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the princess ignored her and sent her to Ponyville to check on the preparations for the celebration. Twi...
256 megabytes
import java.io.*; import java.util.*; public class Main { static ArrayList<Integer>[] adj; static int[] degree; static boolean[] marked; static ArrayList<Integer> path; public static void main(String[] args) { BufferedReader br = new BufferedReader( new InputStreamReader( System.in) , 8* 1024); Scanner...
Java
["3 2\n1 2\n2 3\n1 1 1", "5 7\n1 2\n1 3\n1 4\n1 5\n3 4\n3 5\n4 5\n0 1 0 1 0", "2 0\n0 0"]
1 second
["3\n1 2 3", "10\n2 1 3 4 5 4 5 4 3 1", "0"]
null
Java 7
standard input
[ "dfs and similar" ]
203be1bbb9bb3648aaa63e81ec2a9db5
The first line contains two integers n and m (2 ≤ n ≤ 105; 0 ≤ m ≤ 105) — the number of places and the number of roads in Ponyville. Each of the following m lines contains two integers ui, vi (1 ≤ ui, vi ≤ n; ui ≠ vi), these integers describe a road between places ui and vi. The next line contains n integers: x1, x2, ....
2,200
Output the number of visited places k in the first line (0 ≤ k ≤ 4n). Then output k integers — the numbers of places in the order of path. If xi = 0, then the i-th place must appear in the path even number of times, else i-th place must appear in the path odd number of times. Note, that given road system has no self-lo...
standard output
PASSED
267b1264315e99ac26aba3fb55a25aac
train_002.jsonl
1406907000
Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the princess ignored her and sent her to Ponyville to check on the preparations for the celebration. Twi...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main{ FastScanner in; PrintWriter out; ArrayList<Integer>[] list; int[] odd; boolean[] used; ArrayList<Integer> ans; public int dfs(int v) { int c = odd[v]; used[v] = true; for (int to : list[v...
Java
["3 2\n1 2\n2 3\n1 1 1", "5 7\n1 2\n1 3\n1 4\n1 5\n3 4\n3 5\n4 5\n0 1 0 1 0", "2 0\n0 0"]
1 second
["3\n1 2 3", "10\n2 1 3 4 5 4 5 4 3 1", "0"]
null
Java 7
standard input
[ "dfs and similar" ]
203be1bbb9bb3648aaa63e81ec2a9db5
The first line contains two integers n and m (2 ≤ n ≤ 105; 0 ≤ m ≤ 105) — the number of places and the number of roads in Ponyville. Each of the following m lines contains two integers ui, vi (1 ≤ ui, vi ≤ n; ui ≠ vi), these integers describe a road between places ui and vi. The next line contains n integers: x1, x2, ....
2,200
Output the number of visited places k in the first line (0 ≤ k ≤ 4n). Then output k integers — the numbers of places in the order of path. If xi = 0, then the i-th place must appear in the path even number of times, else i-th place must appear in the path odd number of times. Note, that given road system has no self-lo...
standard output
PASSED
35946bbbeb0bc45252b1b0c59962dc0d
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class frtrt { public static void main(String[] args) { Scanner sc=new Scanner (System.in); int n=sc.nextInt(); int ar[]=new int[n]; for(int i=0;i<n;i++) { ar[i]=sc.nextInt(); } for(int i=1;i<n;i++) { ar[i]=ar[i]+ar...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 8
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
d6654e570df098b79bde6a66a30c6dcb
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Scanner; public class worm { public static void main(String[] args) { // TODO Auto-generated method stub int test, n, m, i, low,high, mid; Scanner scan =new Scanner(System.in); n=scan.nextInt(); int[] arr=new int[n+1]; arr[0]=0; for(i=1...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 8
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
2838a641fa210b881bb6b75fc4c378e6
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Scanner; public class worm { public static void main(String[] args) { // TODO Auto-generated method stub int test, n, m, i, low,high, mid; Scanner scan =new Scanner(System.in); n=scan.nextInt(); int[] arr=new int[n+1]; arr[0]=0; for(i=1...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 8
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
e016cbd64fca70067123a3d885ee15af
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.Map; import java.util.Scanner; public class NewClass { // static int answer = -1; //static LinkedHashMap<Integer,Integer> hm=new LinkedHashMap<Integer,Integer>(); //static int[] arr; public static void main (String[]args...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 8
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
bd1760d7eba320054bbe5c203ade77a3
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Scanner; public class Worms { public static void main(String[] args) { Scanner sca = new Scanner(System.in); int numero_frascos = sca.nextInt(); int Ngusanos = 0; int[] cantidad_frasco = new int[numero_frascos]; int i, j, temp; for (i = 0; i < numer...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 8
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
43f6d10c2420a42692f9890ce254240c
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Scanner; public class Worms { public static void main(String[] args) { Scanner sca = new Scanner(System.in); int numero_frascos = sca.nextInt(); int Ngusanos = 0; int[] cantidad_frasco = new int[numero_frascos]; int i, j, temp; for (i = 0; i < nume...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 8
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
ae694d511fb5c5fc0d051de03bc51cd9
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.TreeSet; public class Main { public static void main(String[] args) throws IOException { Solution2.main(); } // TreeSet solution; BufferedReader necessary to meet time limits. private ...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 8
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
e1db298c31c312f80231d3a488170f27
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.TreeSet; public class Main { public static void main(String[] args) throws IOException { Solution1.main(); } // TreeSet solution private static class Solution1 { public static ...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 8
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
d5d4ef02a803a19be7846632bfc910c8
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class problemA{ public static void main (String []args ) { Scanner s= new Scanner(System.in); int n=s.nextInt(); int m=0; int []arr=new int[20000100]; for(int i=0;i<n;i++) { int x =s.nextInt(); for(int j=0;j<x;j++) { arr[++m]=i+1; } } ...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 8
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
324b94e9e6134edab5eef571910edd07
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.*; public class prac2 { public static void main(String[] ar) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int n = Integer.parseInt(br.readLine()); String[] s = br.readLi...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
43634e949fe7966414e26b2cb7e26d79
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the te...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
b2c2fb2c4606dfb23e70bc7abb12abc5
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { //Locale.setDefault (Locale.US); Reader in = new Reader(); StringBuilder out = new StringBuilder(); int n, m, t, c; ArrayList<Integer> pile = new ArrayLis...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
36f2f1365f29d68140d8d23ad28f55c4
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang.Exception { BufferedReader br= new BufferedReader(new In...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
c8b60ba8a6161a68c5248cfd88afa5f3
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Scanner; public class exe { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long a[] = new long[n + 1]; for (int i = 1; i <= n; i++) { a[i] = in.nextLong() + a[i - 1]; } int m = in.nextI...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
c7ad1ddca2cd94c7b8aab018a4a27cbf
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public stat...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
dfb3b87800018505578e6b839be70cae
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class TB { public void solve(int n, int[] a, int m, int[] q) { int[][] sum = new int[n][2]; sum[0][0] = 1; sum[...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
e18acadc7b1882f4b3690f9030daac6a
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.*; import java.util.*; public class Worms { public static void main(String[] args) throws IOException { int n,m,worm; int[] piles; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; n = Integer.parseInt(br.readLine()); piles = new int[n]; st = n...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
1d056f976c065ff797e07f72a24a9abd
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String argv []) { Scanner sc = new Scanner(System.in); int num = sc.nextInt(); int a[] = new int[1000000]; int previous = 0; int next = 0; for(int i = 0; i < num; i++) { next += sc.nextInt(); for(int j = previous; j < next; j++)...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
a97a39b6776fa906619835e0e34ca4ef
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
/** * Simple Array Program * loops practice */ import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; /** * * @author ganesh */ public class CodeFo...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
0276ce601fd52c399de6d6e0565de350
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class MainB_2 { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
c1fae66527ffdeee46925fd35e40a169
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class MainB_2 { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
46f42fb6f1846d76fa7a46e39506fd7b
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class MainB_2 { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
1da1833d8783edd3e3ea5e1457a44528
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class MainB { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void run() { int n = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; ...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
34b1cf937b6039416cbaa6e58ea2b967
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
//################################################################################################################ import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Unsupported...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
20fc94e8e428af2e25c8caec3e6a3487
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class CF271B { public static void main(final String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] seqNums = new int[n]; for (int i = 0; i < n; i++) { int curr = sc.nextInt(); ...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
4c0ac048f40bfaa90dd8922fdad0346a
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Scanner; public class B { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] piles = new int[n]; for (int i = 0; i < piles.length; i++...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
4df4d6d4119f8a7e229c84de2704b852
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.*; public class R271_2_B { public static void main(String[] args) { Scanner in = new Scanner(System.in); StringBuilder out = new StringBuilder(); int ind, n = in.nextInt(); int[] sum = new int[n+1]; for (int i = 1; i <= n; i++) sum[i] = sum[i-1] + in.nextInt...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
7116ef42680a63cab304b5328268dac2
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import java.io.*; import java.math.*; import java.text.*; import java.util.*; import static java.lang.Math.min; import static java.lang.Math.max; /* br = new BufferedReader(new FileReader("input.txt")); pw = new PrintWriter(new BufferedWriter(new Fil...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
bfa055d68a6cd6d0e336c418c2d52710
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Scanner; public class Main { public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException { Scanner s = ne...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
38f42c0d14d94af6a2281572ba5317d6
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Worms { /** * @param args */ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = In...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
b6fbc9efed20fa2bdf55e1d2c9c917ee
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Scanner; public class ProblemB { private static int search(int[] a, int q){ int l = 0, r = a.length - 1; if (q <= a[0]){ return 0; } while (l < r) { int m = (r + l) / 2; if (a[m] < q){ if (a[m + 1] >= q){ return m + 1; } else { l = m + 1; } } else {...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
32fd90dedd435040dc64cee1cad9d9d5
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; public class Main { static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); static final int INF = Integer.MAX_VALUE / 10; stat...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
cef861479831ff8a854764ecf80ea1b7
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Scanner; /** * * @author hao */ public class Keyboard { static int n,b; static int a[] = new int[100001]; static int sum[] = new int[100001]; /** * @param args the command line arguments */ public static int find(int l,int r,int x) { if (l == r) return l;...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
3b20edaa39c72c7818e0694262cee654
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int array[] = new int[100...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
15dbf8a105e02afea2915fe9f3975c46
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Vector; public class aa { public static void main(String[] args) { try{ BufferedReader br = new BufferedReader(new InputStreamReader (Sy...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
f73e7c26ac84bec0d8e9b5bfec561258
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.*; public class maximus { public static void main(String [] args){ Scanner in=new Scanner(System.in); int n=in.nextInt(); int array[]=new int [n+1]; int sum=0; for(int i=1;i<=n;i++){ array[i]=in.nextInt(); sum+=array[i]; array[i]=sum; } int temp[]=new int[sum+1]; int ptr=0; for(int i=1;i<=...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
fc07c8019d59d6943e39b06785f29230
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.*; import java.io.*; public class wormi{ public static PrintWriter out = new PrintWriter(System.out);//HACER FLUSHHHH public static void main(String args[]) throws IOException{ BufferedReader lector = new BufferedReader(new InputStreamReader(System.in)); int cont =Integer.parseInt(lector.readLine()); S...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
5d8871fc9163a33a4cc1151b3b942fd0
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.io.*; import java.util.*; public class Smile { static int binarySearch(int[] array, int n, int key) { int left = 0; int right = n; while (true) { int mid = left + (right - left) / 2; if (mid == 0) { return mid; } else if (key <= array[mid] && key ...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
e3ef289e0fd18d0b89f6b97c483c3284
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
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.Comparator; import java.util.Scanner; public class B271 { public void solve() throws IOException { Scanner sc = new Scanner(System.in); ...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
56e9c1daf232238b64238b595e72c92f
train_002.jsonl
1412609400
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch.Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are labeled with numbers 1 to a1, worms in second pile are labeled with numbers ...
256 megabytes
import java.util.Scanner; public class BBB { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int [] ans = new int[(int)1e6+1]; int sum = 0, k = 0; for (int i = 1; i <= n; i++) { int x = sc.nextInt(); sum+=x; for (int j = k; j <= sum; j++) { ...
Java
["5\n2 7 3 4 9\n3\n1 25 11"]
1 second
["1\n5\n3"]
NoteFor the sample input: The worms with labels from [1, 2] are in the first pile. The worms with labels from [3, 9] are in the second pile. The worms with labels from [10, 12] are in the third pile. The worms with labels from [13, 16] are in the fourth pile. The worms with labels from [17, 25] are in the fifth pi...
Java 6
standard input
[ "binary search", "implementation" ]
10f4fc5cc2fcec02ebfb7f34d83debac
The first line contains a single integer n (1 ≤ n ≤ 105), the number of piles. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 103, a1 + a2 + ... + an ≤ 106), where ai is the number of worms in the i-th pile. The third line contains single integer m (1 ≤ m ≤ 105), the number of juicy worms said by Marmot....
1,200
Print m lines to the standard output. The i-th line should contain an integer, representing the number of the pile where the worm labeled with the number qi is.
standard output
PASSED
226dbf75add210927db4616af9227c1c
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.StreamTokenizer; import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Reader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class M...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
f8da3471554f750e612c546e81bfd0b3
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main{ static int[] z; public static void Z(StringBuilder s){ int L = 0, R = 0; int n = s.length(); z = new int[n]; for (int i = 1; i < n; i++) { if (i > R) { ...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
b90bb9414a31f4ca2a104c07ea2b3d48
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { BufferedReader in; StringTokenizer st; PrintWriter out; void solve() throws IOException { String s = (char) (20) + ns(); int[] z = z(s); int[] p = new int[z.length]; Arrays.fill(...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
3da1e93d8e25c44d6fe9272497c8726e
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class Main { private static void debug(Object... args) { System.out.println(Arrays.deepToString(args)); } public static void main(String[]rags) throws Exception { BufferedReader br = n...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
0a7c89dc277a5f1bb5f8a5e7aeb4eab4
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner cin = new Scanner(System.in); StringBuilder cs = new StringBuilder(cin.next()); int len = cs.length(); int cv[] = new int[len]; for (...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
1360a161ab15272f2c1d1e0b31ad8022
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.lang.*; import java.awt.geom.Line2D; import java.io.*; import java.util.*; import java.math.*; public class B implements Runnable{ public int[] pf(String str) { char[] s = str.toCharArray(); int[] p = new int[s.length]; int n = s.length; p[0] = 0; f...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
1d67c98f0987b1593728a1b63b40d0f7
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.fill; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { public static void main(String[] args) throws IOException { new Thread(null, new Runnable() { public voi...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
bba4f412b587644d38f155266fe88b24
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.fill; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { public static void main(String[] args) throws IOException { new Thread(null, new Runnable() { public voi...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
bde3ca4025aee1ff8c02b4651a1ac28c
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; public class Contest_93_B { static int[] fail; public static void Zfunction (String s) { fail=new int[s.length()]; int l = 0, r = 0; for (int i...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
4244bbbad9ceda3151be671b8d8dd398
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; public class Contest_93_B { static int[] z; public static int[] Zfunction3(String n) { z = new int[n.length()]; for (int i = 1, l = 0, r = 0; i < n.length(); ++i) { if (i <= r) { z[i...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
c4f608453da7e431ea9aca334a24cd56
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.*; import java.util.*; public class Main { BufferedReader in; PrintStream out; StringTokenizer tok; Scanner sc; public Main() throws NumberFormatException, IOException { //sc = new Scanner(System.in); //sc = new Scanner(new FileReader("in.txt")); in = new BufferedReader(new InputStreamReader(...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
ffcb6b830a5a054e80b8ed284f66e515
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.*; public class Codeforces_Password { public static int[] prefixFunction(String s) { int n = s.length(); int[] p = new int[n]; for (int i = 1; i < n; i++) { int k = p[i - 1]; while (k > 0 && s.charAt(k) != s.charAt(i)) k = p[k - 1]; p[i] = k + (s.charAt(k) ==...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
a21a32c5ed3582700c5e91625eca144f
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.awt.*; import java.io.*; import java.math.*; import java.util.*; import static java.lang.Math.*; public class BetaRound93_Div1_B implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args) { new Th...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
9148c5a99094b086214135cc987aaca3
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.awt.*; import java.io.*; import java.math.*; import java.util.*; import static java.lang.Math.*; public class BetaRound93_Div1_B implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args) { new Thread(null, new Bet...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
73a561a688fc3833494c0be3dddf18b0
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.awt.*; import java.io.*; import java.math.*; import java.util.*; import static java.lang.Math.*; public class BetaRound93_Div1_B implements Runnable { BufferedReader in; PrintWriter out; StringTokenizer tok = new StringTokenizer(""); public static void main(String[] args) { new Th...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
3987caca6f68ccf4f16fe05a7b1a8f50
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.TreeSet; public class B { private static int[] prfunc (char[] s) { int n = s.length; i...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
4e79037d5644fac5045f22320d34d9ac
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { char[] s = in.next().toCharArray(); int[] z = zAlgo(s); int max = 0; int ind = 0; boolean f...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
dd0dc4d61dfb381f004388c17e6fb4e0
train_002.jsonl
1320858000
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class round93B { static char[] Text, Pattern; static int[] back; static int n, m; static ArrayList<Integer> occurrences; static BufferedReader br = new BufferedRea...
Java
["fixprefixsuffix", "abcdabc"]
2 seconds
["fix", "Just a legend"]
null
Java 6
standard input
[ "dp", "hashing", "string suffix structures", "binary search", "strings" ]
fd94aea7ca077ee2806653d22d006fb1
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
1,700
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
standard output
PASSED
23d30d1879e6b6f957b321fb85958820
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numCha...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
b747ffa9d22500fdd89892359066410f
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numCha...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
fecc6a45cafcb567af4d2100b25551cd
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
//package mailru2018; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class D { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(), K =...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
2728f8e0b10c68ff1ebb79f9854bd1a9
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; /* spar5h */ public class cf4 implements Runnable{ static void addMap(HashMap<Integer, Integer> hm, int x) { if(hm.get(x) != null) hm.put(x, hm.get(x) + 1); else hm.put(x, 1); } static ...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
829756bb7b4c9f201df82f9198c708e8
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.io.*; import java.util.*; public class D implements Runnable { public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();} public void run() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); System.err.println("Go!"); int n = ...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
c312eaf37a9c2dafb82f781de86368c1
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.HashMap; import java.util.InputMismatchException; import java.io.IOExcep...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
e4a80a4274648adbb7a763e716aacbb7
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; public class D { void submit() { int n = nextInt(); int k = nextInt(); int[] a = new int[n + 1]; for (int i = 0; i < n; i++) { a[i + 1] = a[i] ^ nextInt(); } int y = (1 << k) - 1; HashMap<Integer, Integer> map = n...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
3e1c5f2a9ec31c492dbb0c5a4016c22c
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode; import java.util.*; import java.util.Map.Entry; public class Main { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter;...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
be4476c2c11674381bc8ccce63dea3d7
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.awt.*; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.List; import static java.lang.Math.max; import static java.lang.Math.min; public class D implements Runnable{ // SOLUTION AT THE TOP OF CODE!!! // HACK ME PLEASE IF YOU CAN!!! ...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
6cceda67f97115c7a3cb681924ef38d9
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.awt.*; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.List; import static java.lang.Math.max; import static java.lang.Math.min; public class D implements Runnable{ // SOLUTION AT THE TOP OF CODE!!! // HACK ME PLEASE IF YOU CAN!!! ...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
4b7266be4fde72d2218f5e5fda5115e4
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.io.*; import java.util.*; public class CFD { BufferedReader br; PrintWriter out; StringTokenizer st; boolean eof; private static final long MOD = 1000L * 1000L * 1000L + 7; private static final int[] dx = {0, -1, 0, 1}; private static final int[] dy = {1, 0, -1, 0}; private...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
590fdbaa264c98d1e593b40fb7f0f7e0
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main4 { static class Reader { private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;} public int read() {if (n...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
190ec042b689de38256f1ad1f2e3dfce
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class D { FastScanner in; PrintWriter out; boolean systemIO = true; public class Pair implements Comparable<Pair> { long x; long y; public Pair(long x, long y) { this.x = x; this.y = y; } @Override public int compareTo(...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
01d78949df5e3539b8a72079069a99d6
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.io.*; import java.util.*; public class p7{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try ...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
3f6a292a4ba2477755ab92d1e71b26a6
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) {new Main().run();} Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); void run(){ out.println(work()); out.flush(); } long work() { int n=in.nextInt(); int k=in...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
19c6f89970f73df26e8a0488366fc303
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class D_MailRu { static int k; static int CST; public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextInt(); k = sc.nextInt(); CST = (1 << k) - 1; Map<Integer, Integer> parti...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
f41457979634cf29195f775e254e1240
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; import java.util.Map.Entry; import static java.lang.Math.*; public class D extends PrintWriter { void run() { int n = nextInt(), k = nextInt(); int[] a = nextArray(n); int mask = (1 << k) - 1; int xor = 0; ...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
d19bcb21187335a0aee88883ad64bf63
train_002.jsonl
1539880500
At a break Vanya came to the class and saw an array of $$$n$$$ $$$k$$$-bit integers $$$a_1, a_2, \ldots, a_n$$$ on the board. An integer $$$x$$$ is called a $$$k$$$-bit integer if $$$0 \leq x \leq 2^k - 1$$$. Of course, Vanya was not able to resist and started changing the numbers written on the board. To ensure that n...
256 megabytes
import java.lang.*; import java.math.*; import java.util.*; import java.io.*; public class Main { class Node implements Comparable<Node>{ int id; int l; int r; public Node(int id,int l,int r){ this.id=id; this.l=l; this.r=r; } public int compareTo(Node c){ int t...
Java
["3 2\n1 3 0", "6 3\n1 4 4 7 3 4"]
1 second
["5", "19"]
NoteIn the first example if Vasya does not perform any operations, he gets an array that has $$$5$$$ segments that Vanya likes. If he performs the operation with $$$i = 2$$$, he gets an array $$$[1, 0, 0]$$$, because $$$\overline{3} = 0$$$ when $$$k = 2$$$. This array has $$$3$$$ segments that Vanya likes. Also, to get...
Java 8
standard input
[ "implementation", "greedy" ]
71ad4b2e9e888933e55425e73a0d68b5
The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \leq n \leq 200\,000$$$, $$$1 \leq k \leq 30$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$0 \leq a_i \leq 2^k - 1$$$), separated by spaces — the array of $$$k$$$-bit integers.
1,900
Print one integer — the maximum possible number of segments with XOR not equal to $$$0$$$ that can be obtained by making several (possibly $$$0$$$) operations described in the statement.
standard output
PASSED
0de4cbab002b8dccde17f51b8c286dc8
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; import java.util.Set; ...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
a10e6ee471e9c22224e5968b3ada76d6
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
//package codeforcesdv246; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String prev[]=new String[n]; String curr[]=new String[n]; for(int i=0;i<n;i++) { prev[i]=sc...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
f44011f062df8330f1741cfddd174713
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class A { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = sc.nextInt(); String[] a = new String[...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
6dbbd280e1b3b73f2da9eaa5feb452d9
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; import java.math.*; public class j8 implements Runnable { public void run(){ InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n=in.nextInt(); HashMap<String,Integer> ha=new HashMap<String,Integer>(); ...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
0f704b3bbcadf76d5bc5cc6f5f072349
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class A { public static void main(String[] args) throws IOException { Reader.init(System.in); int n = Reader.nextInt(); HashMap<String, Intege...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output
PASSED
c328180437706b7d2a3af9008aac4d2e
train_002.jsonl
1530110100
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.The valid sizes of T-shirts are either "M" or from $$$0$$$ to $$$3$$$ "X" followed by "S" or "L". For example, sizes "M", "XXS", "L", "XXXL" are valid and "XM", "Z", "XXXXL" are ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Soly { static final int INF = Integer.MAX_VALUE; static int mergeSort(int[] a,int [] c, int begin, int end) { int ...
Java
["3\nXS\nXS\nM\nXL\nS\nXS", "2\nXXXL\nXXL\nXXL\nXXXS", "2\nM\nXS\nXS\nM"]
2 seconds
["2", "1", "0"]
NoteIn the first example Ksenia can replace "M" with "S" and "S" in one of the occurrences of "XS" with "L".In the second example Ksenia should replace "L" in "XXXL" with "S".In the third example lists are equal.
Java 8
standard input
[ "implementation", "greedy" ]
c8321b60a6ad04093dee3eeb9ee27b6f
The first line contains one integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of T-shirts. The $$$i$$$-th of the next $$$n$$$ lines contains $$$a_i$$$ — the size of the $$$i$$$-th T-shirt of the list for the previous year. The $$$i$$$-th of the next $$$n$$$ lines contains $$$b_i$$$ — the size of the $$$i$$$-th T-shi...
1,200
Print the minimal number of seconds Ksenia is required to spend to change the last year list to the current one. If the lists are already equal, print 0.
standard output