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 | f895d7c269a08f5944740fcd47b47aa3 | train_001.jsonl | 1595601300 | The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,... | 256 megabytes | import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int t... | Java | ["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"] | 1 second | ["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"] | NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between... | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"strings"
] | 6983823efdc512f8759203460cd6bb4c | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e... | 1,200 | For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans... | standard output | |
PASSED | 10b6570352344630b9cb5b899eebb575 | train_001.jsonl | 1595601300 | The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int a[] = new int[n];
char c[] = new char[... | Java | ["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"] | 1 second | ["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"] | NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between... | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"strings"
] | 6983823efdc512f8759203460cd6bb4c | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e... | 1,200 | For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans... | standard output | |
PASSED | f2f5ca83770d0cea6bd9d4d9c332449a | train_001.jsonl | 1595601300 | The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int cases = Integer.valueOf(sc.nextLine());
String data = "abcdefghijklmnopqrstuvwxyz";
StringBuilder sb1, sb2;
while (cases-- > 0) {
int len = Integer.valueOf(sc.nextLine());
... | Java | ["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"] | 1 second | ["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"] | NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between... | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"strings"
] | 6983823efdc512f8759203460cd6bb4c | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e... | 1,200 | For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans... | standard output | |
PASSED | 363494d5befd4e15503695bb88799f4d | train_001.jsonl | 1595601300 | The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,... | 256 megabytes | //package A;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class A659Div2 {
public static void main(String args[]) throws IOException {
BufferedReader br= new BufferedReader(new InputStreamRe... | Java | ["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"] | 1 second | ["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"] | NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between... | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"strings"
] | 6983823efdc512f8759203460cd6bb4c | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e... | 1,200 | For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans... | standard output | |
PASSED | 77fea26a8bd1255b8d29fcbf35aca507 | train_001.jsonl | 1595601300 | The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,... | 256 megabytes | import java.util.*;
public class Solution
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
long t = sc.nextLong();
outer:
while(t-- > 0)
{
long n = sc.nextLong();
long A[] = new long[(int)n];
long max = Long.MIN_VALUE;
for(int i=0;i<n;i++)
{
A[i] = sc.ne... | Java | ["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"] | 1 second | ["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"] | NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between... | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"strings"
] | 6983823efdc512f8759203460cd6bb4c | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e... | 1,200 | For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans... | standard output | |
PASSED | 5fc781f9471bac5dcbdcf5f3996dc23a | train_001.jsonl | 1595601300 | The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,... | 256 megabytes | import java.util.*;
import java.text.*;
import java.io.*;
public final class Solve {
static void solve(int[] arr, int n) {
int max = max(arr);
String p = "" , next = "";
char s = 'b';
for(int i = 0;i<=max;i++) {
p('a');
p += 'a';
}
p("\n");
for(int i = 0;i<n;i++) {
... | Java | ["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"] | 1 second | ["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"] | NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between... | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"strings"
] | 6983823efdc512f8759203460cd6bb4c | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e... | 1,200 | For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans... | standard output | |
PASSED | d85efbdd150ad711fece94a9ded8e04c | train_001.jsonl | 1595601300 | The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,... | 256 megabytes | import java.util.Scanner;
public class StringTransformation {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T-->0){
int n = sc.nextInt();
int[] a = new int[n];
for(int i = 0; i ... | Java | ["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"] | 1 second | ["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"] | NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between... | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"strings"
] | 6983823efdc512f8759203460cd6bb4c | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e... | 1,200 | For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans... | standard output | |
PASSED | 7a8980d3791fe82a9491bbea21946a23 | train_001.jsonl | 1595601300 | The length of the longest common prefix of two strings $$$s = s_1 s_2 \ldots s_n$$$ and $$$t = t_1 t_2 \ldots t_m$$$ is defined as the maximum integer $$$k$$$ ($$$0 \le k \le min(n,m)$$$) such that $$$s_1 s_2 \ldots s_k$$$ equals $$$t_1 t_2 \ldots t_k$$$.Koa the Koala initially has $$$n+1$$$ strings $$$s_1, s_2, \dots,... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class CommonPrefixes {
public static void main(String[] args) {
byte[] mas;
Scanner sc = new Scanner(System.in);
byte t = sc.nextByte();
for (int i = 0; i < t; i++) {
byte max = 1;
byte n = sc.nextByte();
mas = new byte[n];
for (int j = 0; ... | Java | ["4\n4\n1 2 4 2\n2\n5 3\n3\n1 3 1\n3\n0 0 0"] | 1 second | ["aeren\nari\narousal\naround\nari\nmonogon\nmonogamy\nmonthly\nkevinvu\nkuroni\nkurioni\nkorone\nanton\nloves\nadhoc\nproblems"] | NoteIn the $$$1$$$-st test case one of the possible answers is $$$s = [aeren, ari, arousal, around, ari]$$$.Lengths of longest common prefixes are: Between $$$\color{red}{a}eren$$$ and $$$\color{red}{a}ri$$$ $$$\rightarrow 1$$$ Between $$$\color{red}{ar}i$$$ and $$$\color{red}{ar}ousal$$$ $$$\rightarrow 2$$$ Between... | Java 8 | standard input | [
"constructive algorithms",
"greedy",
"strings"
] | 6983823efdc512f8759203460cd6bb4c | Each test contains multiple test cases. The first line contains $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the number of elements in the list $$$a$$$. The second line of e... | 1,200 | For each test case: Output $$$n+1$$$ lines. In the $$$i$$$-th line print string $$$s_i$$$ ($$$1 \le |s_i| \le 200$$$), consisting of lowercase Latin letters. Length of the longest common prefix of strings $$$s_i$$$ and $$$s_{i+1}$$$ has to be equal to $$$a_i$$$. If there are many answers print any. We can show that ans... | standard output | |
PASSED | 3a0fe571d7b62da4953d505d5a9ad025 | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.util.Random;
import java.util.StringTokenizer;
public class Main {
long b = 31;
String fileName = "";
////////////////////// SOLUTION SOLUTION SOLUTION //////////////////////////////
int INF = Integer.MAX_VALUE / 10;
long MODULO = 1000*... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | 5aa271f2e2c1050dc3e37411a8c197c5 | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Solution {
private static final boolean DEBUG = false;
... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | 385daf1bd2a0fa951a56963b333a0c3b | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | /**
* @author Finn Lidbetter
*/
import java.util.*;
import java.io.*;
import java.awt.geom.*;
public class TaskC {
static int n;
static int nLeft;
static int[][] park;
static int[][] move;
static int spaceRow;
static int spaceCol;
static StringBuilder sb;
static int totalMoves = 0;
public static vo... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | 2ca789cee43a2565d8130230d596d35c | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | import java.io.*;
import java.util.Iterator;
import java.util.StringTokenizer;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
My... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | f7c34dfcbfffb64f1058f32e7858926e | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | //package baobab;
import java.io.*;
import java.util.*;
public class C {
public static void main(String[] args) {
Solver solver = new Solver();
}
static class Solver {
IO io;
public Solver() {
this.io = new IO();
try {
solve();
... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | 03ee70e8f66b83669aef1a79ac026ed2 | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | import java.io.BufferedReader;
// import java.io.FileInputStream;
// import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Map;
import java.util.Random;
import java.util.StringTo... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | f76e98e88374ed8f05d04fa0bc756d5b | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | fdbc34bd8fe13d143bdc5f743d658010 | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes |
import java.util.*;
import java.io.*;
public class Solution1 {
private void solve() throws IOException {
int n = in.nextInt();
int k = in.nextInt();
int[][] parking = new int[4][n];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < n; j++) {
parking[i]... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | 26408decf67b5d2a1768cbe0d33d6c56 | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | import java.io.*;
import java.util.*;
public class C implements Runnable{
public static void main (String[] args) {new Thread(null, new C(), "fuuuuuuuuck", 1 << 28).start();}
int done = 0;
public void run() {
FastScanner fs = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
System.err.prin... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | bf5d6b7f1fe95742ff4f1cff75142438 | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
new Solver().run(1);
}
}
class Solver {
private BufferedReader reader = null;
private StringTokenizer st = null;
private static final int MAXSTEPS = 20000;
private int... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | ea9d1640989d5efd4306deca26a163e3 | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | /*
Keep solving problems.
*/
import java.util.*;
import java.io.*;
public class CFA {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
private static final long MOD = 1000 * 1000 * 1000 + 7;
private static final int[] dx = {0, -1, 0, 1};
private static final int[] dy = ... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | 5c5d0e6c8c4ed2fa3cde8e758fbaecd1 | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Arr... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | 648427fd31c9b24f2958c1f88f13f44e | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.BigInteger;
import java.util.Map.Entry;
import static java.lang.Math.*;
public class C extends PrintWriter {
void move(int id, int fx, int fy, int tx, int ty, int m, int[][] b, List<String> ans) {
while (fy < ty) {
int nx = fx;
... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | dbb643f03f07034cfde8aa95529b382f | train_001.jsonl | 1529858100 | Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will arrange them, he realizes that he has a problem. Allen's future parking lot can be represe... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class GC {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader... | Java | ["4 5\n1 2 0 4\n1 2 0 4\n5 0 0 3\n0 5 0 3", "1 2\n1\n2\n1\n2", "1 2\n1\n1\n2\n2"] | 3 seconds | ["6\n1 1 1\n2 1 2\n4 1 4\n3 4 4\n5 3 2\n5 4 2", "-1", "2\n1 1 1\n2 4 1"] | NoteIn the first sample test case, all cars are in front of their spots except car $$$5$$$, which is in front of the parking spot adjacent. The example shows the shortest possible sequence of moves, but any sequence of length at most $$$20000$$$ will be accepted.In the second sample test case, there is only one column,... | Java 8 | standard input | [] | a8d1a78ae2093d2e0de8e4efcbf940c7 | The first line of the input contains two space-separated integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 50$$$, $$$1 \le k \le 2n$$$), representing the number of columns and the number of cars, respectively. The next four lines will contain $$$n$$$ integers each between $$$0$$$ and $$$k$$$ inclusive, representing the init... | 2,100 | If there is a sequence of moves that brings all of the cars to their parking spaces, with at most $$$20000$$$ car moves, then print $$$m$$$, the number of moves, on the first line. On the following $$$m$$$ lines, print the moves (one move per line) in the format $$$i$$$ $$$r$$$ $$$c$$$, which corresponds to Allen movin... | standard output | |
PASSED | 7cb6e36ba68dd47d5acb40fd654aae8c | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | import java.awt.Point;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.math.BigInteger;
import java.io.*;
import java.util.*;
public class Main {
int n, k;
String wall[] = new String[2];
int mark[][] = new int[2][100001];
boolean calc() {
TreeSet<Pair<Pair<Integer, Inte... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | f0f644eeef85bd00beaabeec4b25dab0 | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.StringTokenizer;
public class c... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 9b961d6d455f05279db33762f522475d | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.math.BigDecimal;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.util.Queue;
import java.util.LinkedList;
import java.io.InputStrea... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 7449cbb6e2a50d1e8705e4ff2a37d2d6 | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.InputMismatchException;
public class Main {
public static void main(String[] args) {
long time_beg = -1;
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
if (args.length > 0 && args[0].equals("outside")) {
time_beg ... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | f36dd7dd634c109f601fc23e3472c74f | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class JumpingOnWalls {
static Scanner in = new Scanner(System.in);
public static void main(String[] args){
new JumpingOnWalls().DFS();
}
private void DFS(){
int n = in.nex... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | ff3ffded32935e5648e29f83965deff5 | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | //package com.yaroslav.shlapak;
import java.util.Scanner;
/**
* Created by y.shlapak on Apr 05, 2016.
*/
/*
7 3
---X--X
-X--XX-
*/
public class JumpingOnWalls {
static int n, k;
static int[][] tunnel;
static int[][] tunnelClone;
static int waterLevel = 0;
static boolean done = false;
publi... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | ad042a1b822c0c6e22a862661957d4b1 | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | //package com.yaroslav.shlapak;
import java.util.Scanner;
/**
* Created by y.shlapak on Apr 05, 2016.
*/
/*
7 3
---X--X
-X--XX-
*/
public class JumpingOnWalls {
static int n, k;
static int[][] tunnel;
static int[][] tunnelClone;
static int waterLevel = 0;
static boolean done = false;
publi... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 7d44c58cd2c448ffac358e101e98995c | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | import java.util.*;
import java.io.*;
public class B125 {
public static void main(String[] args) throws IOException
{
input.init(System.in);
int n = 2, m = input.nextInt(), x = input.nextInt();
char[][] grid = new char[n][m];
for(int i = 0; i<n; i++) grid[i] = input.next().toCharArray();
boolean res... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 68b363d191a7a72b71c1645428b6cb55 | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | import java.io.Closeable;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.Collection;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.Iterator;
import java.util.ArrayDeque;
import java... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 38534fdebe1af5b4f2a4d0a3d4ca121c | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class B implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer st;
Random rnd;
String[] walls = new String[2];
int[][] distances = new int[2][];
final int inf = Integer.MAX_VALUE / 2;
Queue<State> q = new ArrayDeque<B.State>(... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 2e1b67449b7d7b730ba5df7747cc6c31 | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 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.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class JumpingonWalls {
static int n, k;
static char[][] s;
static String b... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | c5aa5b1ccc8ea49c9951cab209d7a9cc | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | import java.io.*;
import java.util.*;
public class BFS_2 {
public static void main(String[] args) {
Scanner util = new Scanner(System.in);
int n = util.nextInt();
int k = util.nextInt();
util.nextLine();
boolean[][] walls = new boolean[2][n];
for(int i = 0; i < 2; i++) {
String in = util.nextLine();
... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 1c1e0884cf4f1edb58a0e2be96fce0e8 | train_001.jsonl | 1340379000 | Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon.The canyon consists of two vertical parallel walls, their height is n meters. Let's imagine that we split these walls into 1 meter-long areas and number them with positive integers from 1 to n from bottom to top. Some a... | 256 megabytes | import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class Main {
static class Point {
public int x,y,step;
public Point(int x, int y, int step) {
this.x = x;
this.y = y;
this.step = step;
}
... | Java | ["7 3\n---X--X\n-X--XX-", "6 2\n--X-X-\nX--XX-"] | 2 seconds | ["YES", "NO"] | NoteIn the first sample the ninja should first jump to the right wall, then go one meter down along the right wall, then jump to the left wall. The next jump can get the ninja from the canyon. In the second sample there's no way the ninja can get out of the canyon. | Java 7 | standard input | [
"dfs and similar",
"shortest paths"
] | e95bde11483e05751ee7da91a6b4ede1 | The first line contains two integers n and k (1 ≤ n, k ≤ 105) — the height of the canyon and the height of ninja's jump, correspondingly. The second line contains the description of the left wall — a string with the length of n characters. The i-th character represents the state of the i-th wall area: character "X" rep... | 1,400 | Print "YES" (without the quotes) if the ninja can get out from the canyon, otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 679119e187e882e42e94c0287f12a431 | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.util.Scanner;
public class Main {
FastScanner in;
PrintWriter out;
static class FastScanner {
BufferedReader br;
StringTokenizer st;
FastScanner(InputStream in) {
br = new BufferedReader(new I... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | 65dd9b0fe49c7bc5c58276a2139a1fab | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class SNT_3 {
static int n;
static int nMAX = 1000006;
static boolean[] f = new boolean[nMAX+1];
static void sNT() {
for (int i = 0; i <= nMAX; i++) {
f[i] = true;
}
f[0] = false;
... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | 707ce35780e8ed3a3708607496b99b7f | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.io.*;
import java.util.*;
public class main {
static StringBuilder out=new StringBuilder();
static FastReader in=new FastReader();
static boolean primes[];
public static void getArrPrimes(int n){
primes=new boolean[n+1];
Arrays.fill(primes, true);
... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | fa8134539ca394aa24f8942c347b93ad | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.util.Scanner;
public class Tprimes {
private static Scanner s = new Scanner(System.in);
static long LIMIT =1000001;
static long i,j;
static long[] prime= new long[1000001];
private static void primelist(){
prime[0]=1; prime[1]=1;
for( i = 2; i< LIMIT; i++){
... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | 89bae4babea536e26936c350b34f2187 | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Tprime {
public static void isprime(boolean[] dp) {
for (int p = 2; p * p < 1000001; p++) {
if (dp[p] == true) {
for (in... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | 427d630b95ea13fdc4db3809c67eedb9 | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.util.*;
import java.io.*;
public class TPrimesB{
public static boolean[] sieveOfEratosthenes(int n) {
boolean[] prime = new boolean[n + 1];
Arrays.fill(prime, true);
int limit = (int)Math.sqrt(n);
for (int p = 2; p <= limit; p++) {
if (prime[p]) {
... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | 390782a4fbb0aa7823d01b132ee2b770 | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | /*input
3
4 5 6
*/
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class problem230b{
public static void main(String[] args) throws IOException{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(in.readLine());
String[] input ... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | c12c0aa5baf2d984c29c4eecd6a56da1 | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{ static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader()
{
din = new DataI... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | 96fd3a26b05157a30d97d5f7d8af13ef | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.util.*;
import java.io.*;
public class Code230 {
public static void main(String[] args) {
FastReader sc = new FastReader();
boolean[] prime = gneratePrime(1000000);
int t = sc.nextInt();
while(t-->0){
double n = sc.nextDouble();
System.out.println... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | 1d4433bcc2d2d9647de954c56971cb22 | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.util.*;
public class Tprime{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
long[] arr = new long[n];
for(int i = 0;i<n;i++){
arr[i] = scan.nextLong();
}
boolean[] prime = new boolean[1000001];
for(int i = 2;i<=1000000;i++){
prime... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | deecc17fc3a9014986c78b3905ecf3e7 | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.util.Scanner;
public class CodeForces {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
boolean[] arr = new boolean[1000000];
for (int j = 0; j < arr.length; j++) {
arr[j] = true;
}
for (int... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | 2333366256a73c6e643f7fffe6c90b82 | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class CodeForces {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
boolean[] arr = new boolean[1000000];
for (int j = 0; j < arr.length; j++) {
... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | a0ca77aa20023a6a31230c64c90b9b86 | train_001.jsonl | 1349105400 | We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t Т-prime, if t has exactly three distinct positive divisors.You are given an array of n positive integers. For each of them determine whether it is Т-prime or not. | 256 megabytes | import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class CodeForces {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
boolean[] arr = new boolean[1000000];
for (int j = 0; j < arr.length; j++) {
... | Java | ["3\n4 5 6"] | 2 seconds | ["YES\nNO\nNO"] | NoteThe given test has three numbers. The first number 4 has exactly three divisors — 1, 2 and 4, thus the answer for this number is "YES". The second number 5 has two divisors (1 and 5), and the third number 6 has four divisors (1, 2, 3, 6), hence the answer for them is "NO". | Java 11 | standard input | [
"binary search",
"number theory",
"implementation",
"math"
] | 6cebf9af5cfbb949f22e8b336bf07044 | The first line contains a single positive integer, n (1 ≤ n ≤ 105), showing how many numbers are in the array. The next line contains n space-separated integers xi (1 ≤ xi ≤ 1012). Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is advised to use the cin, cout streams or the %I64d spec... | 1,300 | Print n lines: the i-th line should contain "YES" (without the quotes), if number xi is Т-prime, and "NO" (without the quotes), if it isn't. | standard output | |
PASSED | 17ff8d71296f0cada2b60f5a3db6ef9f | train_001.jsonl | 1318919400 | Three sons inherited from their father a rectangular corn fiend divided into n × m squares. For each square we know how many tons of corn grows on it. The father, an old farmer did not love all three sons equally, which is why he bequeathed to divide his field into three parts containing A, B and C tons of corn.The fie... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
static boolean FROM_FILE = true;
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
if (FROM_FILE) {
try {
br ... | Java | ["3 3\n1 1 1\n1 1 1\n1 1 1\n3 3 3", "2 5\n1 1 1 1 1\n2 2 2 2 2\n3 6 6", "3 3\n1 2 3\n3 1 2\n2 3 1\n5 6 7"] | 1 second | ["2", "3", "0"] | NoteThe lines dividing the field can be horizontal or vertical, but they should be parallel to each other. | Java 11 | input.txt | [
"brute force"
] | ef162ba7ca860369cf950d9a3686ddc8 | The first line contains space-separated integers n and m — the sizes of the original (1 ≤ n, m ≤ 50, max(n, m) ≥ 3). Then the field's description follows: n lines, each containing m space-separated integers cij, (0 ≤ cij ≤ 100) — the number of tons of corn each square contains. The last line contains space-separated in... | 1,400 | Print the answer to the problem: the number of ways to divide the father's field so that one of the resulting parts contained A tons of corn, another one contained B tons, and the remaining one contained C tons. If no such way exists, print 0. | output.txt | |
PASSED | 677f0b9f1a9f75d5efd51fc1b81340b1 | train_001.jsonl | 1379691000 | A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, sequence [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] are not.A fixed point of a function is a point that is mapped to itself by the function. A permutation can... | 256 megabytes |
import java.util.HashMap;
import java.util.Scanner;
public class Problem2 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n;
n = scanner.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = scanner.nex... | Java | ["5\n0 1 3 4 2"] | 2 seconds | ["3"] | null | Java 6 | standard input | [
"implementation",
"brute force",
"math"
] | e63de0fffd00b2da103545a7f1e405be | The first line contains a single integer n (1 ≤ n ≤ 105). The second line contains n integers a0, a1, ..., an - 1 — the given permutation. | 1,100 | Print a single integer — the maximum possible number of fixed points in the permutation after at most one swap operation. | standard output | |
PASSED | bd6efa86c7c5c94f077a29b7311f77fc | train_001.jsonl | 1379691000 | A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, sequence [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] are not.A fixed point of a function is a point that is mapped to itself by the function. A permutation can... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;
public class B {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStre... | Java | ["5\n0 1 3 4 2"] | 2 seconds | ["3"] | null | Java 6 | standard input | [
"implementation",
"brute force",
"math"
] | e63de0fffd00b2da103545a7f1e405be | The first line contains a single integer n (1 ≤ n ≤ 105). The second line contains n integers a0, a1, ..., an - 1 — the given permutation. | 1,100 | Print a single integer — the maximum possible number of fixed points in the permutation after at most one swap operation. | standard output | |
PASSED | 3b5962eb14f379bb14c90d5ebc4089c6 | train_001.jsonl | 1379691000 | A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, sequence [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] are not.A fixed point of a function is a point that is mapped to itself by the function. A permutation can... | 256 megabytes | import java.util.LinkedList;
import java.util.Scanner;
public class Contest201_div2_B
{
public static void main(String ... args)
{
Scanner in = new Scanner(System.in);
int row = in.nextInt();
int[] n = new int[row];
LinkedList<Integer> fn = new LinkedList<Integer>();
... | Java | ["5\n0 1 3 4 2"] | 2 seconds | ["3"] | null | Java 6 | standard input | [
"implementation",
"brute force",
"math"
] | e63de0fffd00b2da103545a7f1e405be | The first line contains a single integer n (1 ≤ n ≤ 105). The second line contains n integers a0, a1, ..., an - 1 — the given permutation. | 1,100 | Print a single integer — the maximum possible number of fixed points in the permutation after at most one swap operation. | standard output | |
PASSED | e0f9d114e656d59935334c875bf9c883 | train_001.jsonl | 1379691000 | A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, sequence [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] are not.A fixed point of a function is a point that is mapped to itself by the function. A permutation can... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.StringTokenizer;
public class B {
static BufferedReader stdin = new BufferedReader(new
InputStreamReader(System.in));
static StringTokenizer st = new StringTokenizer("");
public static void main(String[... | Java | ["5\n0 1 3 4 2"] | 2 seconds | ["3"] | null | Java 6 | standard input | [
"implementation",
"brute force",
"math"
] | e63de0fffd00b2da103545a7f1e405be | The first line contains a single integer n (1 ≤ n ≤ 105). The second line contains n integers a0, a1, ..., an - 1 — the given permutation. | 1,100 | Print a single integer — the maximum possible number of fixed points in the permutation after at most one swap operation. | standard output | |
PASSED | 28b1f3075b865293f7d1257d73b51419 | train_001.jsonl | 1379691000 | A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, sequence [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] are not.A fixed point of a function is a point that is mapped to itself by the function. A permutation can... | 256 megabytes |
import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int a[] = new int[n];
for(int i = 0;i < n;i++){
a[i] = input.nextInt();
}
int flag = 0;
int fixedCount = 0;
for(int i = 0;i < n;i++){
if(a[i] == ... | Java | ["5\n0 1 3 4 2"] | 2 seconds | ["3"] | null | Java 6 | standard input | [
"implementation",
"brute force",
"math"
] | e63de0fffd00b2da103545a7f1e405be | The first line contains a single integer n (1 ≤ n ≤ 105). The second line contains n integers a0, a1, ..., an - 1 — the given permutation. | 1,100 | Print a single integer — the maximum possible number of fixed points in the permutation after at most one swap operation. | standard output | |
PASSED | baf6dbd196f848a110d7f6f79488b351 | train_001.jsonl | 1379691000 | A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, sequence [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] are not.A fixed point of a function is a point that is mapped to itself by the function. A permutation can... | 256 megabytes | //package pack;
import java.util.Scanner;
public class Training {
public static void main (String[] args)
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] v = new int[100009];
int cont = 0;
for(int i = 0 ;i < n ; i++)
{
v[i] = sc.ne... | Java | ["5\n0 1 3 4 2"] | 2 seconds | ["3"] | null | Java 6 | standard input | [
"implementation",
"brute force",
"math"
] | e63de0fffd00b2da103545a7f1e405be | The first line contains a single integer n (1 ≤ n ≤ 105). The second line contains n integers a0, a1, ..., an - 1 — the given permutation. | 1,100 | Print a single integer — the maximum possible number of fixed points in the permutation after at most one swap operation. | standard output | |
PASSED | cdd4497bd248a6f3994565ce4dee42f5 | train_001.jsonl | 1379691000 | A permutation of length n is an integer sequence such that each integer from 0 to (n - 1) appears exactly once in it. For example, sequence [0, 2, 1] is a permutation of length 3 while both [0, 2, 2] and [1, 2, 3] are not.A fixed point of a function is a point that is mapped to itself by the function. A permutation can... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class B {
private static BufferedReader in;
private static StringTokenizer st;
... | Java | ["5\n0 1 3 4 2"] | 2 seconds | ["3"] | null | Java 6 | standard input | [
"implementation",
"brute force",
"math"
] | e63de0fffd00b2da103545a7f1e405be | The first line contains a single integer n (1 ≤ n ≤ 105). The second line contains n integers a0, a1, ..., an - 1 — the given permutation. | 1,100 | Print a single integer — the maximum possible number of fixed points in the permutation after at most one swap operation. | standard output | |
PASSED | 557cbdf1f8cd38816ffff05a2d00d691 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static InputReader in = new InputReader();
public static void main(String[] args) throws Exception {
int n = in.nextInt();
long[] a = new long[n];
for(int i=0;i<n;i++) a[i] = in.nextLong();
Arrays.sort(a);
long[] b = new long[n];
long[] ... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 65657a80c5829f4e9573ccb7b6806d5d | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.*;
import java.util.*;
public class D_671_1 {
static int p=1000000007;
public static void main(String[] args) throws Exception{
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
FastReader sc=new FastR... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | f0655d3262f675e117a2a4f607be9e92 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;import java.io.*;import java.math.*;
public class Birthday
{
public static void process()throws IOException
{
int n = ni();
int[] a = nai(n);
ruffleSort(a);
int c = 0, total = 0;
int[] ans = new int[n];
for(int i = 1; i < n-1; i+=2){
... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | d35803e1de9e24e187a180c9b0ecde10 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;
import java.io.*;
public class D2
{
public static void main(String args[]) throws IOException
{
// BufferedReader br = new BufferedReader(new FileReader("input.txt"));
// BufferedWriter bw = new BufferedWriter(new FileWriter("output.txt"));
BufferedReader br = new BufferedReader(new InputSt... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 4c252722f9b69e39d4eccef1cfe91761 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
ArrayList<Integer> list=new ArrayList<>();
for(int i=0;i<n;i++)
list.add(sc.nextInt());
Collections.sort(list);
int arr[... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | c51d0bc16c5ef7ecd171ee26e1d91f77 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 2e799db950208272f82ed12b8e3b326b | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Random;
import java.util.StringTokenizer;
public class Hellojava
{
pu... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | ac76ee68bfa8d07bca73ff82e3f14ebd | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
im... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 94bd1cfbdf2a03b9f4410f2d612e5d5e | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.*;
import java.util.*;
public class d2671 implements Runnable
{
private boolean console=false;
public void solve()
{
int i;
int n=in.ni();
Integer a[]=new Integer[n];
for(i=0;i<n;i++)
a[i]=in.ni();
if(n<=2)
{
out.println(0);
for(i=0;i<n;i++)
out.print(a[i]+" ");
return;
... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 9ad1cab54bf1bc511bab343b85a5a54d | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main12{
static public void main(String args[])throws IOException{
int tt=1;
StringBuilder sb=new StringBuilder();
for(int ttt=1;ttt<=tt;ttt++){
int n=i();
int[] a... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 4b54bf2ec14e5020f17e5cde10e03119 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
import java.lang.*;
public class d1 extends PrintWriter {
static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
// static Scanner s=new Scanne... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 3ea4ce9b84692c0d909d6d448d71f786 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.uti... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 91d380deb9480528f7bcc29b2628a61f | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.*;
import java.util.*;
public class A
{
static int n, x;
static int[] arr;
public static void main(String[] args) throws IOException
{
Flash f = new Flash();
n = f.ni(); arr = f.arr(n);
fn();
}
static void fn()
{
if(n == 1){
... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | b8df3b133850a4bc72d44096490dc1b5 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes |
import java.io.PrintWriter;
import java.util.*;
public class D1 {
public static PrintWriter out = new PrintWriter(System.out);
public static Scanner in = new Scanner(System.in);
public static void main(String[] args) {
solve();
out.flush();
}
private static void solve() {
int n = ni();
in... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 8a9defcd1f1bf8a80bc66a34292158d5 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public final class D2 {
public static void main(String[] args) {
final FastScanner fs = new FastScanner();
final int n ... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | dfa89d8f661138e426466185d739a28f | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
static long mod = (int)(998244353);
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
public static void main(String[] args)throws IOException {
Scanner sc =new Scanner(System.in);
//FastReader sc =... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | ff2ec69c6be0d8c847c30077fc1220e7 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;
public class Main {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedR... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | b3aa1272b4080e9ac65629cc5365a9b5 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class bdday
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 7de92271e0e6281bbd3f3a018e70f0d4 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;
import java.io.*;
public class birthday {
public static void main(String[] args) throws java.io.IOException {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
int prices = input.nextInt();
int[] price = new int[prices];
for (int ... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 38d3f450fd2fc448ffc72a2c049bd32d | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
public class P3{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
PrintWriter out=new PrintWriter(System.out);
int n=sc.nextInt();
int[] arr=new int[n];
... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | ccc9777e36745b42b3327d874a5bc8ec | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class jav{
public static void main(String[] args) throws IOException{
Reader sc=new Reader();
PrintWriter pw=new PrintWriter(System.out);
int n=sc.nextInt();
int a[]=sc.nextIntArray(n);
int ans[]=new int[n];
int j=... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | ae41ddd1986b7a117b39f4a55d177810 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static int[] spheres;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(n... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 4a7176150d6708af3ca8503fc507627f | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.*;
import java.util.*;
public class current {
public static void main(String[] args) {
FastReader fr = new FastReader();
int l = fr.nextInt();
solve(longList(fr.nextLine().split(" ")), l);
}
public static void solve(List<Long> list, int l) {
Collections.sort(... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | a3be2576c19ef713b36a41ef6ab04f61 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Main
{
public static void main (String[] args) {
// your code goes here
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int[] a = new int[n];
for(int i=0; i<n; i++)
a[i] = s.nextInt();
Arrays.s... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | e77a409acdd7de56162bbbe3b9590dd7 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | /*
Written by Kabir Kanha Arora
@kabirkanha
*/
import java.util.*;
public class Main {
static long MOD = 1000000007;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; ++... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | 2796096683fe506b0578934342a02419 | train_001.jsonl | 1600526100 | This is the hard version of the problem. The difference between the versions is that in the easy version all prices $$$a_i$$$ are different. You can make hacks if and only if you solved both versions of the problem.Today is Sage's birthday, and she will go shopping to buy ice spheres. All $$$n$$$ ice spheres are placed... | 256 megabytes | import java.io.BufferedReader;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.lang.reflect.Array;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Object... | Java | ["7\n1 3 2 2 4 5 4"] | 1 second | ["3\n3 1 4 2 4 2 5"] | NoteIn the sample it's not possible to place the ice spheres in any order so that Sage would buy $$$4$$$ of them. If the spheres are placed in the order $$$(3, 1, 4, 2, 4, 2, 5)$$$, then Sage will buy one sphere for $$$1$$$ and two spheres for $$$2$$$ each. | Java 11 | standard input | [
"greedy",
"constructive algorithms",
"two pointers",
"sortings",
"binary search",
"brute force"
] | 6443dffb38285b6deb74f2371d8d0cac | The first line contains a single integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of ice spheres in the shop. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$ — the prices of ice spheres. | 1,500 | In the first line print the maximum number of ice spheres that Sage can buy. In the second line print the prices of ice spheres in the optimal order. If there are several correct answers, you can print any of them. | standard output | |
PASSED | f03f2b5ab5b5c237d8b1453b28a7c098 | train_001.jsonl | 1433435400 | You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order). | 256 megabytes | import java.util.Scanner;
public class TwoSubstrings {
public TwoSubstrings() {
super();
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
boolean ab = false, ba = false, found = false;
String sub = s.subst... | Java | ["ABA", "BACFAB", "AXBYBXA"] | 2 seconds | ["NO", "YES", "NO"] | NoteIn the first sample test, despite the fact that there are substrings "AB" and "BA", their occurrences overlap, so the answer is "NO".In the second sample test there are the following occurrences of the substrings: BACFAB.In the third sample test there is no substring "AB" nor substring "BA". | Java 7 | standard input | [
"dp",
"greedy",
"implementation",
"brute force",
"strings"
] | 33f7c85e47bd6c83ab694a834fa728a2 | The only line of input contains a string s of length between 1 and 105 consisting of uppercase Latin letters. | 1,500 | Print "YES" (without the quotes), if string s contains two non-overlapping substrings "AB" and "BA", and "NO" otherwise. | standard output | |
PASSED | d05213e0102785ee9b9f01eb72da094b | train_001.jsonl | 1433435400 | You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order). | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class cf1 {
static String s;
static int[][][] memo;
public static boolean contains(int start, int end, int found) {
if (found == 3) {
return true;
}
if (end - start < 1) ... | Java | ["ABA", "BACFAB", "AXBYBXA"] | 2 seconds | ["NO", "YES", "NO"] | NoteIn the first sample test, despite the fact that there are substrings "AB" and "BA", their occurrences overlap, so the answer is "NO".In the second sample test there are the following occurrences of the substrings: BACFAB.In the third sample test there is no substring "AB" nor substring "BA". | Java 7 | standard input | [
"dp",
"greedy",
"implementation",
"brute force",
"strings"
] | 33f7c85e47bd6c83ab694a834fa728a2 | The only line of input contains a string s of length between 1 and 105 consisting of uppercase Latin letters. | 1,500 | Print "YES" (without the quotes), if string s contains two non-overlapping substrings "AB" and "BA", and "NO" otherwise. | standard output | |
PASSED | 55e1d854757b74ce232812711730e42f | train_001.jsonl | 1433435400 | You are given string s. Your task is to determine if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order). | 256 megabytes | import java.util.Scanner;
public class Test{
public static boolean reemplazar(StringBuilder s, String str){
int index = s.toString().indexOf(str);
if(index < 0){
return false;
}
s.replace(index, index+2,"__");
return true;
}
public static boolean isValid(StringBuilder ... | Java | ["ABA", "BACFAB", "AXBYBXA"] | 2 seconds | ["NO", "YES", "NO"] | NoteIn the first sample test, despite the fact that there are substrings "AB" and "BA", their occurrences overlap, so the answer is "NO".In the second sample test there are the following occurrences of the substrings: BACFAB.In the third sample test there is no substring "AB" nor substring "BA". | Java 7 | standard input | [
"dp",
"greedy",
"implementation",
"brute force",
"strings"
] | 33f7c85e47bd6c83ab694a834fa728a2 | The only line of input contains a string s of length between 1 and 105 consisting of uppercase Latin letters. | 1,500 | Print "YES" (without the quotes), if string s contains two non-overlapping substrings "AB" and "BA", and "NO" otherwise. | standard output | |
PASSED | deeb9e44e4aaaec418c0a6382ac54fa9 | train_001.jsonl | 1400914800 | Tachibana Kanade likes Mapo Tofu very much. One day, the canteen cooked all kinds of tofu to sell, but not all tofu is Mapo Tofu, only those spicy enough can be called Mapo Tofu.Each piece of tofu in the canteen is given a m-based number, all numbers are in the range [l, r] (l and r being m-based numbers), and for ever... | 512 megabytes | import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Queue;
import java.util.Scanner;
public class CF433E {
static final int MOD = 1000000007;
public static void main(String[] args) throws Exception {
new CF433E().solve();
}
private void solve()... | Java | ["2 10 1\n1 1\n3 1 0 0\n1 1 1\n1 0 1", "2 10 12\n2 5 9\n6 6 3 5 4 9 7\n2 0 6 1\n3 6 7 2 1", "4 2 6\n6 1 0 1 1 1 0\n6 1 1 0 1 0 0\n1 1 2\n3 0 1 0 5\n4 0 1 1 0 4\n3 1 0 1 2"] | 5 seconds | ["97", "635439", "2"] | NoteIn the first sample, 10, 11 and 100 are the only three decimal numbers in [1, 100] with a value greater than 1. Here the value of 1 is 1 but not 2, since numbers cannot contain leading zeros and thus cannot be written as "01".In the second sample, no numbers in the given interval have a value greater than 12.In the... | Java 7 | standard input | [
"dp"
] | 9e83ebfda6eaa583af11b5883bfaab23 | The first line contains three integers n, m and k (1 ≤ n ≤ 200; 2 ≤ m ≤ 20; 1 ≤ k ≤ 500). Where n denotes the number of strings, m denotes the base used, and k denotes the limit of the value for Mapo Tofu. The second line represents the number l. The first integer in the line is len (1 ≤ len ≤ 200), describing the leng... | 2,500 | Output the number of pieces of Mapo Tofu modulo 1000000007 (109 + 7). The answer should be a decimal integer. | standard output | |
PASSED | 5ce1cc4632e17415646c68a32ca38ba7 | train_001.jsonl | 1400914800 | Tachibana Kanade likes Mapo Tofu very much. One day, the canteen cooked all kinds of tofu to sell, but not all tofu is Mapo Tofu, only those spicy enough can be called Mapo Tofu.Each piece of tofu in the canteen is given a m-based number, all numbers are in the range [l, r] (l and r being m-based numbers), and for ever... | 512 megabytes | import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Queue;
import java.util.Scanner;
public class CF433E {
static final int MOD = 1000000007;
public static void main(String[] args) throws Exception {
new CF433E().solve();
}
private void solve()... | Java | ["2 10 1\n1 1\n3 1 0 0\n1 1 1\n1 0 1", "2 10 12\n2 5 9\n6 6 3 5 4 9 7\n2 0 6 1\n3 6 7 2 1", "4 2 6\n6 1 0 1 1 1 0\n6 1 1 0 1 0 0\n1 1 2\n3 0 1 0 5\n4 0 1 1 0 4\n3 1 0 1 2"] | 5 seconds | ["97", "635439", "2"] | NoteIn the first sample, 10, 11 and 100 are the only three decimal numbers in [1, 100] with a value greater than 1. Here the value of 1 is 1 but not 2, since numbers cannot contain leading zeros and thus cannot be written as "01".In the second sample, no numbers in the given interval have a value greater than 12.In the... | Java 7 | standard input | [
"dp"
] | 9e83ebfda6eaa583af11b5883bfaab23 | The first line contains three integers n, m and k (1 ≤ n ≤ 200; 2 ≤ m ≤ 20; 1 ≤ k ≤ 500). Where n denotes the number of strings, m denotes the base used, and k denotes the limit of the value for Mapo Tofu. The second line represents the number l. The first integer in the line is len (1 ≤ len ≤ 200), describing the leng... | 2,500 | Output the number of pieces of Mapo Tofu modulo 1000000007 (109 + 7). The answer should be a decimal integer. | standard output | |
PASSED | afa4482892ba3fe98deaf1e66cae1939 | train_001.jsonl | 1516462500 | Given an array a1, a2, ..., an of n integers, find the largest number in the array that is not a perfect square.A number x is said to be a perfect square if there exists an integer y such that x = y2. | 256 megabytes | import java.util.Scanner;
public class PerfectSquares {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int out = 0;
for(int i = 0; i < n; i++) {
int a = scan.nextInt();
double sqrtA = Math.sqrt(a);
if(sqrtA != (int) sqrtA && a > out) out = a;
... | Java | ["2\n4 2", "8\n1 2 4 8 16 32 64 576"] | 1 second | ["2", "32"] | NoteIn the first sample case, 4 is a perfect square, so the largest number in the array that is not a perfect square is 2. | Java 8 | standard input | [
"implementation",
"brute force",
"math"
] | d46d5f130d8c443f28b52096c384fef3 | The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of elements in the array. The second line contains n integers a1, a2, ..., an ( - 106 ≤ ai ≤ 106) — the elements of the array. It is guaranteed that at least one element of the array is not a perfect square. | 900 | Print the largest number in the array which is not a perfect square. It is guaranteed that an answer always exists. | standard output | |
PASSED | 012dd0d484dd85ccf369985582f783e6 | train_001.jsonl | 1516462500 | Given an array a1, a2, ..., an of n integers, find the largest number in the array that is not a perfect square.A number x is said to be a perfect square if there exists an integer y such that x = y2. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
*
* @author Home
*/
public class Hi {
public static void main(String[] args) throws IOException {
BufferedReader input = new BufferedReader(new InputStreamReader(Sy... | Java | ["2\n4 2", "8\n1 2 4 8 16 32 64 576"] | 1 second | ["2", "32"] | NoteIn the first sample case, 4 is a perfect square, so the largest number in the array that is not a perfect square is 2. | Java 8 | standard input | [
"implementation",
"brute force",
"math"
] | d46d5f130d8c443f28b52096c384fef3 | The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of elements in the array. The second line contains n integers a1, a2, ..., an ( - 106 ≤ ai ≤ 106) — the elements of the array. It is guaranteed that at least one element of the array is not a perfect square. | 900 | Print the largest number in the array which is not a perfect square. It is guaranteed that an answer always exists. | standard output | |
PASSED | 64ae150f8109ff8d0b07e672ebb732dd | train_001.jsonl | 1577198100 | Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.The exam consists of $$$n$$$ problems that can be solved in $$$T$$$ minutes. Thus, the exam begins at time $$$0$$$ and ends at time $$$T$$$. Petya can leave the exam at a... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template ... | Java | ["10\n3 5 1 3\n0 0 1\n2 1 4\n2 5 2 3\n1 0\n3 2\n1 20 2 4\n0\n16\n6 20 2 5\n1 1 0 1 0 0\n0 8 2 9 11 6\n4 16 3 6\n1 0 1 1\n8 3 5 6\n6 20 3 6\n0 1 0 0 1 0\n20 11 3 20 16 17\n7 17 1 6\n1 1 0 1 0 0 0\n1 7 0 11 10 15 10\n6 17 2 6\n0 0 1 0 0 1\n7 6 3 7 10 12\n5 17 2 5\n1 1 1 1 0\n17 11 10 6 4\n1 1 1 2\n0\n1"] | 2 seconds | ["3\n2\n1\n0\n1\n4\n0\n1\n2\n1"] | null | Java 8 | standard input | [
"two pointers",
"sortings",
"greedy"
] | 6c165390c7f9fee059ef197ef40ae64f | The first line contains the integer $$$m$$$ ($$$1 \le m \le 10^4$$$) — the number of test cases in the test. The next lines contain a description of $$$m$$$ test cases. The first line of each test case contains four integers $$$n, T, a, b$$$ ($$$2 \le n \le 2\cdot10^5$$$, $$$1 \le T \le 10^9$$$, $$$1 \le a < b \le ... | 1,800 | Print the answers to $$$m$$$ test cases. For each set, print a single integer — maximal number of points that he can receive, before leaving the exam. | standard output | |
PASSED | 7651f33f7d20add30eece5c9a59fa544 | train_001.jsonl | 1577198100 | Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.The exam consists of $$$n$$$ problems that can be solved in $$$T$$$ minutes. Thus, the exam begins at time $$$0$$$ and ends at time $$$T$$$. Petya can leave the exam at a... | 256 megabytes | import java.util.*;
import java.io.*;
public class c {
public static void main(String[] Args)
throws Exception
{
FS sc = new FS(System.in);
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int t = sc.nextInt();
while (t-->0) {
... | Java | ["10\n3 5 1 3\n0 0 1\n2 1 4\n2 5 2 3\n1 0\n3 2\n1 20 2 4\n0\n16\n6 20 2 5\n1 1 0 1 0 0\n0 8 2 9 11 6\n4 16 3 6\n1 0 1 1\n8 3 5 6\n6 20 3 6\n0 1 0 0 1 0\n20 11 3 20 16 17\n7 17 1 6\n1 1 0 1 0 0 0\n1 7 0 11 10 15 10\n6 17 2 6\n0 0 1 0 0 1\n7 6 3 7 10 12\n5 17 2 5\n1 1 1 1 0\n17 11 10 6 4\n1 1 1 2\n0\n1"] | 2 seconds | ["3\n2\n1\n0\n1\n4\n0\n1\n2\n1"] | null | Java 8 | standard input | [
"two pointers",
"sortings",
"greedy"
] | 6c165390c7f9fee059ef197ef40ae64f | The first line contains the integer $$$m$$$ ($$$1 \le m \le 10^4$$$) — the number of test cases in the test. The next lines contain a description of $$$m$$$ test cases. The first line of each test case contains four integers $$$n, T, a, b$$$ ($$$2 \le n \le 2\cdot10^5$$$, $$$1 \le T \le 10^9$$$, $$$1 \le a < b \le ... | 1,800 | Print the answers to $$$m$$$ test cases. For each set, print a single integer — maximal number of points that he can receive, before leaving the exam. | standard output | |
PASSED | 7d555147cf7d9f897d66dd98c2993ca5 | train_001.jsonl | 1577198100 | Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.The exam consists of $$$n$$$ problems that can be solved in $$$T$$$ minutes. Thus, the exam begins at time $$$0$$$ and ends at time $$$T$$$. Petya can leave the exam at a... | 256 megabytes | import java.io.*;
import java.util.*;
public class D {
FastScanner scanner;
PrintWriter writer;
void solve() throws IOException {
scanner = new FastScanner(System.in);
writer = new PrintWriter(System.out);
int tests = scanner.nextInt();
for (int t = 0; t < tests; t++) {
... | Java | ["10\n3 5 1 3\n0 0 1\n2 1 4\n2 5 2 3\n1 0\n3 2\n1 20 2 4\n0\n16\n6 20 2 5\n1 1 0 1 0 0\n0 8 2 9 11 6\n4 16 3 6\n1 0 1 1\n8 3 5 6\n6 20 3 6\n0 1 0 0 1 0\n20 11 3 20 16 17\n7 17 1 6\n1 1 0 1 0 0 0\n1 7 0 11 10 15 10\n6 17 2 6\n0 0 1 0 0 1\n7 6 3 7 10 12\n5 17 2 5\n1 1 1 1 0\n17 11 10 6 4\n1 1 1 2\n0\n1"] | 2 seconds | ["3\n2\n1\n0\n1\n4\n0\n1\n2\n1"] | null | Java 8 | standard input | [
"two pointers",
"sortings",
"greedy"
] | 6c165390c7f9fee059ef197ef40ae64f | The first line contains the integer $$$m$$$ ($$$1 \le m \le 10^4$$$) — the number of test cases in the test. The next lines contain a description of $$$m$$$ test cases. The first line of each test case contains four integers $$$n, T, a, b$$$ ($$$2 \le n \le 2\cdot10^5$$$, $$$1 \le T \le 10^9$$$, $$$1 \le a < b \le ... | 1,800 | Print the answers to $$$m$$$ test cases. For each set, print a single integer — maximal number of points that he can receive, before leaving the exam. | standard output | |
PASSED | b8e972e6986720a45b0fe2a7ac9f7790 | train_001.jsonl | 1577198100 | Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.The exam consists of $$$n$$$ problems that can be solved in $$$T$$$ minutes. Thus, the exam begins at time $$$0$$$ and ends at time $$$T$$$. Petya can leave the exam at a... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.io.Writer;
impo... | Java | ["10\n3 5 1 3\n0 0 1\n2 1 4\n2 5 2 3\n1 0\n3 2\n1 20 2 4\n0\n16\n6 20 2 5\n1 1 0 1 0 0\n0 8 2 9 11 6\n4 16 3 6\n1 0 1 1\n8 3 5 6\n6 20 3 6\n0 1 0 0 1 0\n20 11 3 20 16 17\n7 17 1 6\n1 1 0 1 0 0 0\n1 7 0 11 10 15 10\n6 17 2 6\n0 0 1 0 0 1\n7 6 3 7 10 12\n5 17 2 5\n1 1 1 1 0\n17 11 10 6 4\n1 1 1 2\n0\n1"] | 2 seconds | ["3\n2\n1\n0\n1\n4\n0\n1\n2\n1"] | null | Java 8 | standard input | [
"two pointers",
"sortings",
"greedy"
] | 6c165390c7f9fee059ef197ef40ae64f | The first line contains the integer $$$m$$$ ($$$1 \le m \le 10^4$$$) — the number of test cases in the test. The next lines contain a description of $$$m$$$ test cases. The first line of each test case contains four integers $$$n, T, a, b$$$ ($$$2 \le n \le 2\cdot10^5$$$, $$$1 \le T \le 10^9$$$, $$$1 \le a < b \le ... | 1,800 | Print the answers to $$$m$$$ test cases. For each set, print a single integer — maximal number of points that he can receive, before leaving the exam. | standard output | |
PASSED | ebdb85bf979a6edbb3d8eacef121a3ac | train_001.jsonl | 1577198100 | Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.The exam consists of $$$n$$$ problems that can be solved in $$$T$$$ minutes. Thus, the exam begins at time $$$0$$$ and ends at time $$$T$$$. Petya can leave the exam at a... | 256 megabytes | import java.io.*;
import java.util.*;
/*
───────────────■■■─────────────────────────
──█▄─▄█─▄▀▀▀▄─█──▄█─────█──▄▀─▄▀▀▀▄─▀▀█▀▀──
──█─▀─█─█───█─█─█─█─────█■█───█───█───█────
──█───█─▀▄▄▄▀─█▀──█─────█──▀▄─▀▄▄▄▀───█────
───────────────────────────────────────────
*/
public class Main {
static FastReader in;
sta... | Java | ["10\n3 5 1 3\n0 0 1\n2 1 4\n2 5 2 3\n1 0\n3 2\n1 20 2 4\n0\n16\n6 20 2 5\n1 1 0 1 0 0\n0 8 2 9 11 6\n4 16 3 6\n1 0 1 1\n8 3 5 6\n6 20 3 6\n0 1 0 0 1 0\n20 11 3 20 16 17\n7 17 1 6\n1 1 0 1 0 0 0\n1 7 0 11 10 15 10\n6 17 2 6\n0 0 1 0 0 1\n7 6 3 7 10 12\n5 17 2 5\n1 1 1 1 0\n17 11 10 6 4\n1 1 1 2\n0\n1"] | 2 seconds | ["3\n2\n1\n0\n1\n4\n0\n1\n2\n1"] | null | Java 8 | standard input | [
"two pointers",
"sortings",
"greedy"
] | 6c165390c7f9fee059ef197ef40ae64f | The first line contains the integer $$$m$$$ ($$$1 \le m \le 10^4$$$) — the number of test cases in the test. The next lines contain a description of $$$m$$$ test cases. The first line of each test case contains four integers $$$n, T, a, b$$$ ($$$2 \le n \le 2\cdot10^5$$$, $$$1 \le T \le 10^9$$$, $$$1 \le a < b \le ... | 1,800 | Print the answers to $$$m$$$ test cases. For each set, print a single integer — maximal number of points that he can receive, before leaving the exam. | standard output | |
PASSED | 0a48036e4d6aa837bc46724c4141551d | train_001.jsonl | 1577198100 | Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.The exam consists of $$$n$$$ problems that can be solved in $$$T$$$ minutes. Thus, the exam begins at time $$$0$$$ and ends at time $$$T$$$. Petya can leave the exam at a... | 256 megabytes | import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
import java.util.TreeSet;
public class C {
public static class Q {
boolean isHard;
int ti;
public Q(int tp, int ti) {
isHard = tp==1;
this.ti = ti;
}
public int getTi() {
... | Java | ["10\n3 5 1 3\n0 0 1\n2 1 4\n2 5 2 3\n1 0\n3 2\n1 20 2 4\n0\n16\n6 20 2 5\n1 1 0 1 0 0\n0 8 2 9 11 6\n4 16 3 6\n1 0 1 1\n8 3 5 6\n6 20 3 6\n0 1 0 0 1 0\n20 11 3 20 16 17\n7 17 1 6\n1 1 0 1 0 0 0\n1 7 0 11 10 15 10\n6 17 2 6\n0 0 1 0 0 1\n7 6 3 7 10 12\n5 17 2 5\n1 1 1 1 0\n17 11 10 6 4\n1 1 1 2\n0\n1"] | 2 seconds | ["3\n2\n1\n0\n1\n4\n0\n1\n2\n1"] | null | Java 8 | standard input | [
"two pointers",
"sortings",
"greedy"
] | 6c165390c7f9fee059ef197ef40ae64f | The first line contains the integer $$$m$$$ ($$$1 \le m \le 10^4$$$) — the number of test cases in the test. The next lines contain a description of $$$m$$$ test cases. The first line of each test case contains four integers $$$n, T, a, b$$$ ($$$2 \le n \le 2\cdot10^5$$$, $$$1 \le T \le 10^9$$$, $$$1 \le a < b \le ... | 1,800 | Print the answers to $$$m$$$ test cases. For each set, print a single integer — maximal number of points that he can receive, before leaving the exam. | standard output | |
PASSED | a40e285786fe1f7d759e62228f044e80 | train_001.jsonl | 1577198100 | Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.The exam consists of $$$n$$$ problems that can be solved in $$$T$$$ minutes. Thus, the exam begins at time $$$0$$$ and ends at time $$$T$$$. Petya can leave the exam at a... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
static PrintWriter out;
static InputReader in;
public static void main(String args[]){
out = new PrintWriter(System.out);
in = new InputReader();
new Main();
out.flush(); out.close();
}
Main(){
solve(... | Java | ["10\n3 5 1 3\n0 0 1\n2 1 4\n2 5 2 3\n1 0\n3 2\n1 20 2 4\n0\n16\n6 20 2 5\n1 1 0 1 0 0\n0 8 2 9 11 6\n4 16 3 6\n1 0 1 1\n8 3 5 6\n6 20 3 6\n0 1 0 0 1 0\n20 11 3 20 16 17\n7 17 1 6\n1 1 0 1 0 0 0\n1 7 0 11 10 15 10\n6 17 2 6\n0 0 1 0 0 1\n7 6 3 7 10 12\n5 17 2 5\n1 1 1 1 0\n17 11 10 6 4\n1 1 1 2\n0\n1"] | 2 seconds | ["3\n2\n1\n0\n1\n4\n0\n1\n2\n1"] | null | Java 8 | standard input | [
"two pointers",
"sortings",
"greedy"
] | 6c165390c7f9fee059ef197ef40ae64f | The first line contains the integer $$$m$$$ ($$$1 \le m \le 10^4$$$) — the number of test cases in the test. The next lines contain a description of $$$m$$$ test cases. The first line of each test case contains four integers $$$n, T, a, b$$$ ($$$2 \le n \le 2\cdot10^5$$$, $$$1 \le T \le 10^9$$$, $$$1 \le a < b \le ... | 1,800 | Print the answers to $$$m$$$ test cases. For each set, print a single integer — maximal number of points that he can receive, before leaving the exam. | standard output | |
PASSED | ab2f92d2b56252ad3097004e3fdfd713 | train_001.jsonl | 1577198100 | Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.The exam consists of $$$n$$$ problems that can be solved in $$$T$$$ minutes. Thus, the exam begins at time $$$0$$$ and ends at time $$$T$$$. Petya can leave the exam at a... | 256 megabytes | import java.util.*;
import java.io.*;
public class DD {
public static void main(String[] args) {
FastScanner scanner = new FastScanner();
PrintWriter out = new PrintWriter(System.out, false);
int m = scanner.nextInt();
while(m-->0) {
int n = scanner.nextInt(), t = scanne... | Java | ["10\n3 5 1 3\n0 0 1\n2 1 4\n2 5 2 3\n1 0\n3 2\n1 20 2 4\n0\n16\n6 20 2 5\n1 1 0 1 0 0\n0 8 2 9 11 6\n4 16 3 6\n1 0 1 1\n8 3 5 6\n6 20 3 6\n0 1 0 0 1 0\n20 11 3 20 16 17\n7 17 1 6\n1 1 0 1 0 0 0\n1 7 0 11 10 15 10\n6 17 2 6\n0 0 1 0 0 1\n7 6 3 7 10 12\n5 17 2 5\n1 1 1 1 0\n17 11 10 6 4\n1 1 1 2\n0\n1"] | 2 seconds | ["3\n2\n1\n0\n1\n4\n0\n1\n2\n1"] | null | Java 8 | standard input | [
"two pointers",
"sortings",
"greedy"
] | 6c165390c7f9fee059ef197ef40ae64f | The first line contains the integer $$$m$$$ ($$$1 \le m \le 10^4$$$) — the number of test cases in the test. The next lines contain a description of $$$m$$$ test cases. The first line of each test case contains four integers $$$n, T, a, b$$$ ($$$2 \le n \le 2\cdot10^5$$$, $$$1 \le T \le 10^9$$$, $$$1 \le a < b \le ... | 1,800 | Print the answers to $$$m$$$ test cases. For each set, print a single integer — maximal number of points that he can receive, before leaving the exam. | standard output | |
PASSED | 5b59ad4711d388e149cc9ea0a1539bda | train_001.jsonl | 1577198100 | Petya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.The exam consists of $$$n$$$ problems that can be solved in $$$T$$$ minutes. Thus, the exam begins at time $$$0$$$ and ends at time $$$T$$$. Petya can leave the exam at a... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Solution implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private Sp... | Java | ["10\n3 5 1 3\n0 0 1\n2 1 4\n2 5 2 3\n1 0\n3 2\n1 20 2 4\n0\n16\n6 20 2 5\n1 1 0 1 0 0\n0 8 2 9 11 6\n4 16 3 6\n1 0 1 1\n8 3 5 6\n6 20 3 6\n0 1 0 0 1 0\n20 11 3 20 16 17\n7 17 1 6\n1 1 0 1 0 0 0\n1 7 0 11 10 15 10\n6 17 2 6\n0 0 1 0 0 1\n7 6 3 7 10 12\n5 17 2 5\n1 1 1 1 0\n17 11 10 6 4\n1 1 1 2\n0\n1"] | 2 seconds | ["3\n2\n1\n0\n1\n4\n0\n1\n2\n1"] | null | Java 8 | standard input | [
"two pointers",
"sortings",
"greedy"
] | 6c165390c7f9fee059ef197ef40ae64f | The first line contains the integer $$$m$$$ ($$$1 \le m \le 10^4$$$) — the number of test cases in the test. The next lines contain a description of $$$m$$$ test cases. The first line of each test case contains four integers $$$n, T, a, b$$$ ($$$2 \le n \le 2\cdot10^5$$$, $$$1 \le T \le 10^9$$$, $$$1 \le a < b \le ... | 1,800 | Print the answers to $$$m$$$ test cases. For each set, print a single integer — maximal number of points that he can receive, before leaving the exam. | standard output | |
PASSED | 8ee74a5083e0498ef26e98bb4cc18ce1 | train_001.jsonl | 1355047200 | In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems... | 256 megabytes | import java.io.File;
import java.io.PrintWriter;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner cin = new Scanner(new File("input.txt"));
PrintWriter out = new PrintWriter... | Java | ["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"] | 1 second | ["2", "3", "1"] | null | Java 8 | input.txt | [
"implementation",
"brute force"
] | 34655e8de9f1020677c5681d9d217d75 | The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1... | 1,500 | Print a single number — the minimum jury size. | output.txt | |
PASSED | 865b0af170b99861cd0149e97eb84b17 | train_001.jsonl | 1355047200 | In 2013, the writers of Berland State University should prepare problems for n Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to n. For each Olympiad we know how many members of the jury must be involved in its preparation, as well as the time required to prepare the problems... | 256 megabytes | /**
* Created with IntelliJ IDEA.
* User: manu
* Date: 09/12/12
* Time: 21:32
* To change this template use File | Settings | File Templates.
*/
import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) throws IOException
{
new B().run();
}
InputReade... | Java | ["2\n5 23 1 2\n3 13 2 3", "3\n12 9 2 1\n12 8 1 3\n12 8 2 2", "1\n1 10 1 13"] | 1 second | ["2", "3", "1"] | null | Java 6 | input.txt | [
"implementation",
"brute force"
] | 34655e8de9f1020677c5681d9d217d75 | The first line contains integer n — the number of Olympiads in 2013 (1 ≤ n ≤ 100). Each of the following n lines contains four integers mi, di, pi and ti — the month and day of the Olympiad (given without leading zeroes), the needed number of the jury members and the time needed to prepare the i-th Olympiad (1 ≤ mi ≤ 1... | 1,500 | Print a single number — the minimum jury size. | output.txt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.