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 | 27636d778803d5f3d9f718f86164bd59 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
public class JavaTest {
private static final PrintWriter out = new PrintWriter(System.out);
private static Scanner sc;
public static void main(String[] args) throws Exception {
InputStream is = JavaTest.class.getReso... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 11 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 1c90ab9d238e1e69bad363130269af8c | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int mod = (int)1e9+7;
static boolean[] prime = new boolean[10];
static int[][] dir1 = new int[][] {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
static int[][] dir2 = new int[][] {{0, 1}, {0, -1}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1,... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 11 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | e1853600daa9089b89e9cd4397fe6595 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class E {
static int x;
static void ex(){
x++;
}
public static void main(String[] args)
{
... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 11 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 1da4c3f4de0faddd12230ddab2afe75d | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.Map.Entry;
public class codeforces {
static int mod = 1000000007;
public static void main(String[] args) {
FastReader sc = new FastReader();
... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 11 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | c05b50bbce14c707a574345d9a4666f4 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
import java.io.*;
public class E {
static class Scan {
private byte[] buf=new byte[1024];
private int index;
private InputStream in;
private int total;
public Scan()
{
in=System.in;
}
public int scan()throws ... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 11 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 73b0cad4ed72279bcac4855bb25ce375 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main
{
InputStream is;
PrintWriter out = new PrintWriter(System.out); ;
String INPUT = "";
void run() throws Exception
{
is = System.in;
solve();
out.flush();
o... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 11 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 34896e6a769817adc210c7172daec89c | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.BufferedReader;
import java.math.BigInteger;
import java.util.*;
import static java.lang.System.out;
// Name: Tastan Yernar && Email: 210103376@stu.sdu.edu.kz//
public class Round_780_Div_3 {
static Scanner str = new Scanner(System.in);
static ArrayList<Integer> list;
final int mod = ... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 11 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | bfa9ce268d35ffa39d4ee4994494457f | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public class codeforces_786_E {
private static void solve(FastIOAdapter in, PrintWriter out) {
int n = in.nextInt();
int[] a = in.readArray(n);
int[] b = a.clone();
ruff... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 11 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | a22d46f188feea8d5fc5f98ffca19cbd | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class q5 {
public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// public static long mod = 1000000007;
public static void solve() throws Exception {
String[] parts = br.readLine().split(" ");
int n = I... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 11 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 851127e80c9fe7ae5f39f78b3eb45d1f | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF1674E extends PrintWriter {
CF1674E() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF1674E o = new CF1674E(); o.main(); o.flush();
}
static final int INF = 0x3f3f3f3f;
void main() {
int n = sc.nex... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 11 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | ec60e012d2f5c476678b36e36bdd02e6 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes |
import java.util.*;
import java.io.*;
public class BreakingTheWall {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(
new InputStreamReader(System.in));
}
String... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 17 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 301ecd2ae3cd585f43c476d2900f00fd | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
/*
* Author: Atuer
*/
public class Main
{
// ==== Solve Code ====//
static int INF = 1000000010;
public static void csh()
{
}
public static void main(String[] args) throws IOException
{
// csh();
// int t = in.nextInt();
// while (t-- > 0)
... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 0c31f560c0d1d1db8e92fba7bf888421 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static int INF = 0x3f3f3f3f;
public static int mod = 1000000007;
public static int mod9 = 998244353;
public static void main(String args[]){
try {
PrintWriter o = new PrintWriter(System.out);
bool... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 1893394c4bba3138e16ca16ddea6d27c | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static int INF = 0x3f3f3f3f;
public static int mod = 1000000007;
public static int mod9 = 998244353;
public static void main(String args[]){
try {
PrintWriter o = new PrintWriter(System.out);
bool... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 93bb19b939e7974b8c95ee7feca3f5a5 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class BreakingTheWall {
private static final int INF = 123456789;
public static void solve(FastIO io) {
final int N = io.nextInt();
final int[] A = io.nextIntArray(N);
io.println(Math.min(bestAny(A), Math.min(bestEveryOther(A), bestAdjacent(A))));
}... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | c365f8acf1b517e41a7ddee67f93d532 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class BreakingTheWall {
private static final int INF = 123456789;
public static void solve(FastIO io) {
final int N = io.nextInt();
final int[] A = io.nextIntArray(N);
io.println(Math.min(bestAny(A), Math.min(bestEveryOther(A), be... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 4055c9e957ef894f3850cd761abbc05e | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class BreakingTheWall {
private static final int INF = 123456789;
public static void solve(FastIO io) {
final int N = io.nextInt();
final int[] A = io.nextIntArray(N);
io.println(Math.min(bestAny(A), Math.min(bestEveryOther(A), be... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | d472a3d3f246816387ad747ed4d66ba3 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
public class c731{
pu... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 52d6b18ac5f6a1a7dcbb94bb7bfeed86 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
public class BreakingTheWall {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
Integer[] a = new Integer[n];
for (int i=0; i<n; i++){
a[i] = s.nextInt();
}
// case 1: two ... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 6d8d35f242196615a8760ac9d2cecb37 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
public class BreakingTheWall {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
Integer[] a = new Integer[n];
for (int i=0; i<n; i++){
a[i] = s.nextInt();
}
// case 1: two ... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | ed7cc8eb533771b83acc4f8aa92a3224 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes |
import java.util.*;
import java.lang.*;
import java.io.*;
public class E {
private static FastReader fr;
private static OutputStream out;
private static int mod = (int)(1e9+7);
private void solve() {
int n = fr.nextInt();
int arr[] = fr.nextIntArray(n);
int ... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | c637b461d6b5d632379d835ef6b41ca9 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Priorit... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | a8ab54752b604496cda8db131381547f | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class yibianguo{
public static void main(String[]args) {
FastScanner c = new FastScanner();
int n = c.nextInt();
int [] a = new int [n];
for(... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 0aef30480383defdef8cc03e08942135 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class E1674 {
public static void main(String[] args) {
InputStr... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | c95a536fa3e8b87d1e35b2e41e660247 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes |
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class BreakingTheWall {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t =1;
// int t = s... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | e174e838282b935b3ac9c52c5ad10afa | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
public class tr0 {
static PrintWriter out;
static StringBuilder sb;
static long mod = (long) 1e9 + 7;
static long inf = (long) 1e16;
static ArrayList<Integer>[] ad, ad1;
static int[][] remove, add;
static long[] inv, f, ncr[];
... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | d68dcfa38e604cda635f22292e6d921f | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.*;
public class Codeforces {
static long mod= Long.MAX_VALUE;
public static void main(String[] args) throws Exception {
PrintWrite... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 9077072bbd9c7952a49ccca9669c3ef4 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.Scanner;
public class E {
public static void main(String[] args) {
new E().solve();
}
public void solve() {
Scanner scanner = new Scanner(System.in);
int t = 1;
while (t-- > 0) {
int n = scanner.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 03862a2a2881b38205a2fed1eb243990 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class CodeForces {
/*-------------------------------------------EDITING CODE STARTS HERE-------------------------------------------*/
public static void solve(int tCase) throws IOException {
int n = sc.nextInt();
int[] arr = new int[n];
//as... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | dcab408143ad866dbdd35296d80ab6fd | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef {
static FastReader in=new FastReader();
static final Random random=new Random();
static long mod=1000000007L;
static long[] fact = new long[16];
static void init() {
fact[0] = 1;
... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 9019e2d38d3d86ad7a2bb2f25b686c9a | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static int solve1(int[]arr) {
int[]arr2 = new int[arr.length];
for(int i=0;i<arr.length;i++) {
arr2[i]=arr[i];
}
sort(arr2);
return ((int)Math.ceil(arr2[0]/2.0) + (int)Math.ceil(arr2[1]/2.0));
}
public static int solve2(int[]a... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 4f0368a1336bd589b011f9a2670ff172 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public class... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 202daadc70e15686649d579231e467f1 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes |
import java.io.*;
import java.util.*;
public final class Main {
//int 2e9 - long 9e18
static PrintWriter out = new PrintWriter(System.out);
static FastReader in = new FastReader();
static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)};
static... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | f6ec4d89f1bbdad877622a3ac576fe8a | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | b8406d074e2371c09c7150af4c036a45 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes |
import java.io.*;
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.sqrt;
import static java.lang.Math.floor;
public class Solution {
static class ListNode {
int val;
ListNode next;
ListNode() {}
ListNode(int ... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 9fc35b92ab125e7114652a74c7960da5 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
public class C {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Integer[] arr = new Integer[n];
int min1 = Integer.MAX_VALUE;
int min2 = Integer.MAX_VALUE;
for (int i = 0; i < n; i++) {... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 23d20836849fab82102b00aa9f71df3a | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private static void solve(int n, int[] arr){
int res = Integer.MAX_VALUE;
for(int i = 1; i < n - 1; i++){
int large = Math.max(arr[i-1], arr[i+1]);
int small = Math.min(arr[i-1], arr[i+1]);
in... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 35fe1f413834bef78fb810c42fc63aa2 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class E_Breaking_the_Wall {
static class Wall {
public int idx, strength;
public Wall(int idx, int strength) {
this.idx = idx;
this.strength = strength;
}
public String toString() {
ret... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | c7cd947a7da00016dddee88c0a7f2b32 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
public class ACM {
private static int[] array;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
array = new int[n];
for (int i = 0; i < n; i++) array[i] = in.nextInt();
help();
}
... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | bea72c6bcff8a8faa97f46d060ebdb3a | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
static PrintWriter pw;
static Scanner sc;
static long solve(int x, int y) {
if (x > y) {
int temp = x;
x = y;
y = temp;
}
int cnt = (y + 1) / 2;
if (cnt > x) {
return cnt;
} else {
return (x + y + 2) / 3;
}
}
... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 525f83f123af6b00a4df0c56793e1b7b | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
public class dict
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int[] arr=new int[n];
for(int i=0;i<n;i++)
arr[i]=sc.nextInt();
int pair=Integer.MAX_VALUE,triplet=Integer.M... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 2982b86374e513e2133cd10935dabdfb | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
import java.io.*;
public class CodeForces {
public static void main(String[] args) throws FileNotFoundException {
FastScanner fs = new FastScanner();
int n = fs.nextInt();
int firstSmall = Integer.MAX_VALUE, secondSmall = Integer.MAX_VALUE;
int[] a = new int[n];
for(i... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 01014973bfaeaaf0e8f9a28327faba47 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int n = sc.nextInt();
int[] dp = new int[1000001];
dp[1] = 1;
dp[2] = 2;
for (int i = 3; i <... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | dde7facd2855988d2072024d51785ce0 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.function.DoubleToLongFunction;
public class Codeforces786{
static long mod = 1000000007L;
static MyScanner sc = new MyScanner();
static void solve() {
int x = sc.nextInt();
int y = sc.nextInt();
if(y%x!=0){
... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | aa9d67902bd9b47119648e3b3c30d260 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
//--------------------------INPUT READER---------------------------------//
static class fs {
public BufferedReader br;
StringTokenizer st = new StringTokenizer("");
public fs() { this(System.in); }
public fs(I... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 0ba818126318c73f86f3a7740564f456 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
public static void main(String args[]) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(S... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 86fb06a72449280e633e0c125a4e12e6 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n+2];
for (int i=1; i<=n; i++) {
a[i] = in.nextInt();
}
a[0] = Integer.MAX_VAL... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | dcb7f56c589348b69cf31efdd5adb870 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
private static final Scanner sc = new Scanner(System.in);
public static void handleTest(){
int n = sc.nextInt();
int[] ar = new int[n];
for(int i = 0; i < n; i++){
ar... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | a88e86bb0378ed540687b98b1ffb04e2 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import javax.print.DocFlavor;
import java.io.*;
import java.util.*;
public class Main {
static PrintWriter pw;
static Scanner sc;
static final int inf = (int) 1e9, mod = inf + 7;
static final long longInf = inf * 1l * inf;
static final double eps = 1e-9;
public static void main(Stri... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | ef30c26a594725f8f2fbbc9a9ba6c665 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
import java.io.*;
public class BreakingTheWall_786E {
public static void main(String[] args) throws NumberFormatException, IOException {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine())... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | f16334cc0bd5cf86c3c8a2ad704ab60b | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.Stack;
impor... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 4e416f73867cdd7492393baa7d6f4a31 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | //Problem: https://codeforces.com/contest/1674/problem/E
//Evan Billingsley 6/20/22
import java.io.*;
import java.util.*;
import java.util.StringTokenizer;
public class WallBreak implements Runnable {
public static void main(String [] args) {
new Thread(null, new WallBreak(), "whatever", 1<<26).sta... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | f9aff65f028a94a8198052bf153fb7d5 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;
/*
getOrDefault
valueOf
System.out.println();
*/
public class HelloWorld{
public static void m... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 8f48b9676b848236501b6eee380ef66b | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | //package Codeforces;
import java.io.*;
import java.util.*;
public class D {
public static void main (String[] Z) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer stz;
int n = Integer.parseInt(br.readLine());
... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 63ec2bd2ba0183eb41536d60abf3cca8 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
/**
*
* @author eslam
*/
public class IceCave {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
Stri... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | d1003affd47d61f2471795866b158b2e | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes |
import java.util.PriorityQueue;
import java.util.Scanner;
public class E {
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 | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 93fd5102c2075d421e5b2f9ae920e5a3 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.util.*;
import java.io.*;
// res.append("Case #"+(p+1)+": "+hh+" \n");
////***************************************************************************
/* public class E_Gardener_and_Tree implements Runnable{
public static void main(String[] args) throws Exception {
new Thr... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 17639caaf1a85018e933e31e986cc357 | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.*;
import java.util.*;
//import javafx.util.*;
public class Main
{
static PrintWriter out = new PrintWriter(System.out);
static FastReader in = new FastReader();
static int INF = Integer.MAX_VALUE;
static int NINF = Integer.MIN_VALUE;
static long mod = 1000000007l;
pu... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | 88ec300600172e1b9d81e816a71561fc | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static int t;
static int n, m;
static int[] a;
static String s;
static FastReader fr = new FastReader();
static PrintWri... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | a6117ce2e09278adcf55d41444ed63ce | train_107.jsonl | 1651502100 | Monocarp plays "Rage of Empires II: Definitive Edition" — a strategic computer game. Right now he's planning to attack his opponent in the game, but Monocarp's forces cannot enter the opponent's territory since the opponent has built a wall.The wall consists of $$$n$$$ sections, aligned in a row. The $$$i$$$-th section... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
public class CF1{
public static void main(String[] args) {
FastScanner sc=new FastScanner();
// int T=sc.nextInt();
int T=1;
for (i... | Java | ["5\n20 10 30 10 20", "3\n1 8 1", "6\n7 6 6 8 5 8", "6\n14 3 8 10 15 4", "4\n1 100 100 1", "3\n40 10 10"] | 2 seconds | ["10", "1", "4", "4", "2", "7"] | NoteIn the first example, it is possible to break the $$$2$$$-nd and the $$$4$$$-th section in $$$10$$$ shots, for example, by shooting the third section $$$10$$$ times. After that, the durabilities become $$$[20, 0, 10, 0, 20]$$$. Another way of doing it is firing $$$5$$$ shots at the $$$2$$$-nd section, and another $... | Java 8 | standard input | [
"binary search",
"brute force",
"constructive algorithms",
"greedy",
"math"
] | f4a7c573ca0c129f241b415577a76ac2 | The first line contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the number of sections. The second line contains the sequence of integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$), where $$$a_i$$$ is the initial durability of the $$$i$$$-th section. | 2,000 | Print one integer — the minimum number of onager shots needed to break at least two sections of the wall. | standard output | |
PASSED | db2e7b0c412ade724ff13b49864abb9b | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Main implements Runnable {
public void solve() throws IOException {
int tt = readInt();
for (int t = 0; t < tt; t++) {
int n = readInt();
long[] a = new long[n + 1];
for (int i = 1; i < n + 1; i++) {
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 17 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 9eaa6d12168a89de93f90a19fbf05795 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.IOException;
import java.util.Scanner;
public class stack
{
public static void main(String[] args) throws IOException
{
Scanner in=new Scanner(System.in);
int test=in.nextInt();
while(test-->0)
{
int n=in.nextInt();
int x[]=new in... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 17 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | f646f36b5830b6e0e72c51633fd8fc63 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;
import java.util.Arrays;
import java.util.*;
public class solve {
private static Scanner sc = new Scanner(System.in);
public static void solve1(){
int n = sc.nextInt();
i... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 17 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 565abf9c9cfd727b11679e67b6b1370c | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.io.*;
import java.security.*;
public class solution {
public static void main(String[] args) throws Exception {
Scanner input;
try {
File file = new File("/home/harsh/Documents/Codes/input.txt");
FileInputStream fis = new FileInputStr... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 17 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 69bdbf43851f7d816d19f6bfc036c187 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int mod = (int) 1e9 + 7;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
long t... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 17 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 2eac3e1cc1b3246eac95fe2d74c0c302 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
public class Main1541B {
public static void main(String[] args) {
Scanner inp=new Scanner(System.in);
int t,n;
t= inp.nextInt();
int[]a=new int[100010];//索引从1开始
for(int k=0;k<t;k++){
long pairs=0L;//初始化不能忘!!!
n = inp.ne... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | e11463ad159d6ab75b8c41d0c1f969c5 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
public class Main1541B {
public static void main(String[] args) {
Scanner inp=new Scanner(System.in);
int t,n;
t= inp.nextInt();
int[]a=new int[100010];//索引从1开始
for(int k=0;k<t;k++){
long pairs=0L;//初始化不能忘!!!
n = inp.ne... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 3747e2b0e199589eefea7691a5c696f7 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
public class Main1541B {
public static void main(String[] args) {
Scanner inp=new Scanner(System.in);
int t,n;
t= inp.nextInt();
int[]a=new int[100010];//索引从1开始
for(int k=0;k<t;k++){
long pairs=0L;//初始化不能忘!!!
n = inp.ne... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | be96f990c72ab786fac6e033d883125b | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
public class Main1541B {
public static void main(String[] args) {
Scanner inp=new Scanner(System.in);
int t,n;
t= inp.nextInt();
int[]a=new int[100010];//索引从1开始
for(int k=0;k<t;k++){
long pairs=0L;//初始化不能忘!!!
n = inp.ne... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 5ef315c5d0c1a90ddfe088db4f709719 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
public static void main(String[] args) throws java.lang.Exception{
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
while(T-->0) {
int n=sc.nextInt();
int a[]=new int[n+1];
for(int i=1;i<=n;i++) {
a[i]=sc.nextInt();
}
long c=0;
for(int i=1... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | d2368fe2f718b7354565ee20be919e67 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.Scanner;
public class PleasantPairs {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
int n, ans;
long a[];
while (t-- > 0) {
n = in.nextInt();
a = new long[n + 1];
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | dc73eb62060c365348f0299657bc0b8d | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;
import java.util.TreeSet;
import static java.lang.System.*;
import static java.lang.Math.*;
public class pre2 {
static cla... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | cea5d52d566a592b1fbb2f3dd417744b | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.Scanner;
public class Solution {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
long t = s.nextLong();
while(t!=0){
long ans = 0;
int n = s.nextInt();
int arr[] = new int[n+1];
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 8975569d95aab873c6ae294bb0238cba | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.io.*;
import java.util.*;
public class PleasantPairs {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-- > 0) {
int N = sc.nextInt();
long[] arr = new long[N+1];
M... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 7563f985f9bc04ea910a09516eea19f8 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.io.*;
import java.util.*;
public class PleasantPairs {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-- > 0) {
int N = sc.nextInt();
long[] arr = new long[N+1];
M... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 05f89dc56dde54de6e44123071dd96d5 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.io.*;
import java.util.*;
public class PleasantPairs {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-- > 0) {
int N = sc.nextInt();
long[] arr = new long[N];
M... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 1a05c82f352bf99e7a9203cb2a45dd23 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.io.*;
import java.util.*;
public class PleasantPairs {
private static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
InputReader sc = new InputReader(System.in);
int T = sc.nextInt();
while(T-- > 0) {
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 272ad119d1139d1dae119f43d9f5249e | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes |
import java.io.*;
import java.util.*;
public class PleasantPairs {
private static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) {
InputReader sc = new InputReader(System.in);
int T = sc.nextInt();
while(T-- > 0) {
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | a41f83949224067156df6c64aaa9dca6 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import javafx.util.Pair;
public class Main
{
static void sort(long a[])
{
Random ran = new Random();
for (int i = 0; i < a.length; i++) {
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 783b24d875f9ad5812f6b1676831f002 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 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.Arrays;
import java.util.StringTokenizer;
public class Main {
private static PrintWriter out = new PrintWriter(System.out);
public static... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | f9d69c36cb6f74b8aea05b945dd3ad70 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deq... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 24ea7fdd45d69aec34dab5294de2233d | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deq... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 5810d0c46a035a8ef421b31f0e51dffc | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Template {
public static class Pair {
int first;
int second;
public Pair(int first, int second) {
this.first = first;
this.second = second;
}
}
static PrintWriter out = new PrintWriter((System.out));
static Read... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 1850ea07f6020d4bb69d46158b9a7738 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Template {
public static class Pair {
int first;
int second;
public Pair(int first, int second) {
this.first = first;
this.second = second;
}
}
static PrintWriter out = new PrintWriter((System.out));
static Read... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | d839927f293ab4bef2592ec6b4218e95 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Template {
public static class Pair {
int first;
int second;
public Pair(int first, int second) {
this.first = first;
this.second = second;
}
}
static PrintWriter out = new PrintWriter((System.out));
static Read... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 6283c3b27b1548586e3bb7a5ed9fb5ab | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int ans[]= new int[(int) (2*1e6)];
static int count=0;
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int t = sc.nextInt();
while (t-->=1){
int n=sc.nextInt();
i... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 0d520038911208fbfbe6c606055e63e9 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int ans[]= new int[(int) (2*1e6)];
static int count=0;
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int t = sc.nextInt();
while (t-->=1){
int n=sc.nextInt();
i... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | e8ea2fd100de1b28f94ee401a30c91e6 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static int ans[]= new int[(int) (2*1e6)];
static int count=0;
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int t = sc.nextInt();
while (t-->=1){
int n=sc.nextInt();
a... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 315788c50cfbb0392adf679e109d64a8 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.awt.Container;
import java.awt.image.SampleModel;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import javax.naming.... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 3c7aab13ae3876864448e27abc36de5d | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;
public class Codeforces {
static Scanner sc=new Sc... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 3125406bfec1754a2279697859c28b9c | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.Random;
import java.util.StringTokenizer;
public class myCode {
public static void main(String[] args) {
FastReader scan = new FastReader();
PrintWriter out = new PrintWriter(System.out);
Task solver = new Task();
int t = scan.... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 9f95971d561c653177b04eebc72a6496 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.Random;
import java.util.StringTokenizer;
public class myCode {
public static void main(String[] args) {
FastReader scan = new FastReader();
PrintWriter out = new PrintWriter(System.out);
Task solver = new Task();
int t = scan.... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 5a288ed1b92ccc3abf2a099a85f7f0e9 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class _practise {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new InputStreamReader(System.in));
}
String next()
{
while ... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 63edc61d199a4b06e57917b8a1be90ca | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class _practise {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new InputStreamReader(System.in));
}
String next()
{
while ... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 91a4f6c530f8d874e56bfb9f62eb5655 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | //--------I---------
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
//--------O---------
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.OutputStreamWriter;
//--------Arrays---------
import java... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 7864ff957bb93baf4ee09847d19e96e3 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | //--------I---------
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
//--------O---------
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.OutputStreamWriter;
//--------Arrays---------
import java.u... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 5722757f4d291dfdd151275c29e1dd09 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.util.*;
public class main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
int[] arr = new int[n+1];
for(int i=1;i<=n;i++) {
arr[i] = sc.nextInt();
}
long count=0;
for(in... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 131f2d4567a26cae4cdc6fd5546ba477 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.File;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class Main {
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 5dd9531f15898cf65828766f5cc874b1 | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.File;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class Main {
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output | |
PASSED | 5cf4deef51216f9b66675d042fbcd7ee | train_107.jsonl | 1624635300 | You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.File;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class Main {
... | Java | ["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"] | 2 seconds | ["1\n1\n3"] | NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3... | Java 8 | standard input | [
"brute force",
"implementation",
"math",
"number theory"
] | 0ce05499cd28f0825580ff48dae9e7a9 | The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer... | 1,200 | For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.