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 | 8a2aeb8f0acf65ead1bac4e19f788015 | train_001.jsonl | 1432658100 | While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | 256 megabytes | import java.awt.List;
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class solver implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws FileNotFound... | Java | ["saba\n2", "saddastavvat\n2"] | 1 second | ["NO", "YES"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | Java 7 | standard input | [
"implementation",
"brute force",
"strings"
] | 43bb8fec6b0636d88ce30f23b61be39f | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | 1,100 | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | standard output | |
PASSED | 7091f384f21c2eb9691bcc651c890f6c | train_001.jsonl | 1432658100 | While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | 256 megabytes | import java.util.Scanner;
public class A305 {
public static boolean isPalindrome(String string)
{
StringBuilder sb=new StringBuilder();
for(int i=string.length()-1;i>=0;i--)
sb.append(string.charAt(i));
return string.equals(sb.toString());
}
public static void main(... | Java | ["saba\n2", "saddastavvat\n2"] | 1 second | ["NO", "YES"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | Java 7 | standard input | [
"implementation",
"brute force",
"strings"
] | 43bb8fec6b0636d88ce30f23b61be39f | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | 1,100 | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | standard output | |
PASSED | d695a132ff77cd1d50e27ce48ce250d8 | train_001.jsonl | 1432658100 | While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | 256 megabytes | import java.util.Scanner;
public class main
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
String x = input.nextLine();
char a[] = new char[x.length()];
for(int i=0;i<x.length();i++)
{
a[i] = x.charAt(i);
... | Java | ["saba\n2", "saddastavvat\n2"] | 1 second | ["NO", "YES"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | Java 7 | standard input | [
"implementation",
"brute force",
"strings"
] | 43bb8fec6b0636d88ce30f23b61be39f | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | 1,100 | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | standard output | |
PASSED | b1a9fa9509830fd6d4af51bea1ffb502 | train_001.jsonl | 1432658100 | While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | 256 megabytes | import java.util.*;
public class Fek {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
int x = Integer.valueOf(sc.nextLine());
if (s.length() % x != 0)
System.out.println("NO");
else {
int div = s.length() / x;
boolean b = true;
int k =... | Java | ["saba\n2", "saddastavvat\n2"] | 1 second | ["NO", "YES"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | Java 7 | standard input | [
"implementation",
"brute force",
"strings"
] | 43bb8fec6b0636d88ce30f23b61be39f | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | 1,100 | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | standard output | |
PASSED | 3bea54bb771995603a5b66a84e64d48b | train_001.jsonl | 1432658100 | While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | 256 megabytes | /*
* Author - Chinmaya Kr. Patanaik
* University - Charles University Prague
*
*/
import java.util.Scanner;
import java.util.*;
public class MikeAndFox_548A
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
String line = scan.next();
int size = scan.n... | Java | ["saba\n2", "saddastavvat\n2"] | 1 second | ["NO", "YES"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | Java 7 | standard input | [
"implementation",
"brute force",
"strings"
] | 43bb8fec6b0636d88ce30f23b61be39f | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | 1,100 | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | standard output | |
PASSED | 11cf8b4605268574c0c9a74b95db3fe3 | train_001.jsonl | 1432658100 | While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
public class Main {
static void solve(InputReader reader, OutputWriter out) throws IOException {
// Scanner in = new Scanner(new BufferedReader(new
// FileReader("input.txt")));
// PrintWriter ou... | Java | ["saba\n2", "saddastavvat\n2"] | 1 second | ["NO", "YES"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | Java 7 | standard input | [
"implementation",
"brute force",
"strings"
] | 43bb8fec6b0636d88ce30f23b61be39f | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | 1,100 | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | standard output | |
PASSED | a5df77f5422432789678bd40600b39e2 | train_001.jsonl | 1432658100 | While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
boolean ans = true;
String s = in.next();
int k = in.nextInt();
String t = "";
int w = s.length() / k;
int start = 0;
while (w != 0) {
if (start + w > s.length())
break;
t... | Java | ["saba\n2", "saddastavvat\n2"] | 1 second | ["NO", "YES"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | Java 7 | standard input | [
"implementation",
"brute force",
"strings"
] | 43bb8fec6b0636d88ce30f23b61be39f | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | 1,100 | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | standard output | |
PASSED | 038864a4d625ab57fcf77456ff74e830 | train_001.jsonl | 1432658100 | While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s. He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in h... | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
String s = in.next();
int k = in.nextInt();
int n = s.length();
int a = n/k;
int m = 0 ;
int l = m+a-1;
int count = 0 ;
if(... | Java | ["saba\n2", "saddastavvat\n2"] | 1 second | ["NO", "YES"] | NotePalindrome is a string reading the same forward and backward.In the second sample, the faxes in his back-bag can be "saddas" and "tavvat". | Java 7 | standard input | [
"implementation",
"brute force",
"strings"
] | 43bb8fec6b0636d88ce30f23b61be39f | The first line of input contains string s containing lowercase English letters (1ββ€β|s|ββ€β1000). The second line contains integer k (1ββ€βkββ€β1000). | 1,100 | Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise. | standard output | |
PASSED | d08d9b039f463249e5875a452b4f0e44 | train_001.jsonl | 1481992500 | Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.The world can be modeled as an undirected graph with n nodes and m edges. k of the nodes are home to the governments of the k countries that make up the world.There is at most one edg... | 256 megabytes |
import java.io.*;
import java.util.*;
public class A
{
static ArrayList<Integer> g[];
static int[] vis,cc;
public static void main(String[] args)throws IOException
{
FastReader f=new FastReader();
StringBuffer sb = new StringBuffer();
int n=f.nextInt();
int m=f.nextInt();
int k=f.nextInt();
... | Java | ["4 1 2\n1 3\n1 2", "3 3 1\n2\n1 2\n1 3\n2 3"] | 2 seconds | ["2", "0"] | NoteFor the first sample test, the graph looks like this: Vertices 1 and 3 are special. The optimal solution is to connect vertex 4 to vertices 1 and 2. This adds a total of 2 edges. We cannot add any more edges, since vertices 1 and 3 cannot have any path between them.For the second sample test, the graph looks lik... | Java 8 | standard input | [
"dfs and similar",
"graphs"
] | 6cf43241b14e4d41ad5b36572f3b3663 | The first line of input will contain three integers n, m and k (1ββ€βnββ€β1β000, 0ββ€βmββ€β100β000, 1ββ€βkββ€βn)Β β the number of vertices and edges in the graph, and the number of vertices that are homes of the government. The next line of input will contain k integers c1,βc2,β...,βck (1ββ€βciββ€βn). These integers will be pa... | 1,500 | Output a single integer, the maximum number of edges Hongcow can add to the graph while keeping it stable. | standard output | |
PASSED | aec3f9b6ed25ba5ee584b5a338029c27 | train_001.jsonl | 1334934300 | The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.The Berland capital's map is represented by an nβΓβm rectangular table. Each cell of the table on the map represents some districts of the capital. The capital's main detective Polycarpus took a map and marked ther... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.Math.*;
public class crocA
{
public static void main(String args[])throws Exception
{
Scanner in=new Scanner(System.in);
//BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//BufferedReader br = new Buffere... | Java | ["3 2\n.*\n..\n**", "3 3\n*.*\n*..\n..."] | 2 seconds | ["1 1", "2 3"] | null | Java 6 | standard input | [
"implementation",
"geometry",
"brute force"
] | e344de8280fb607c556671db9cfbaa9e | The first line contains two space-separated integers n and m (2ββ€βn,βmββ€β100) β the number of rows and columns in the table, correspondingly. Each of the next n lines contains m characters β the description of the capital's map. Each character can either be a "." (dot), or an "*" (asterisk). A character equals "*" if t... | 800 | Print two integers β the number of the row and the number of the column of the city district that is the fourth one to be robbed. The rows are numbered starting from one from top to bottom and the columns are numbered starting from one from left to right. | standard output | |
PASSED | 29b732612e1d65faaa6f0b85c37fc659 | train_001.jsonl | 1334934300 | The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.The Berland capital's map is represented by an nβΓβm rectangular table. Each cell of the table on the map represents some districts of the capital. The capital's main detective Polycarpus took a map and marked ther... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.Math.*;
public class crocA
{
public static void main(String args[])throws Exception
{
Scanner in=new Scanner(System.in);
//BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//BufferedReader br = new Buffere... | Java | ["3 2\n.*\n..\n**", "3 3\n*.*\n*..\n..."] | 2 seconds | ["1 1", "2 3"] | null | Java 6 | standard input | [
"implementation",
"geometry",
"brute force"
] | e344de8280fb607c556671db9cfbaa9e | The first line contains two space-separated integers n and m (2ββ€βn,βmββ€β100) β the number of rows and columns in the table, correspondingly. Each of the next n lines contains m characters β the description of the capital's map. Each character can either be a "." (dot), or an "*" (asterisk). A character equals "*" if t... | 800 | Print two integers β the number of the row and the number of the column of the city district that is the fourth one to be robbed. The rows are numbered starting from one from top to bottom and the columns are numbered starting from one from left to right. | standard output | |
PASSED | ec6a3ec7021774ea12954af77cb4d157 | train_001.jsonl | 1334934300 | The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.The Berland capital's map is represented by an nβΓβm rectangular table. Each cell of the table on the map represents some districts of the capital. The capital's main detective Polycarpus took a map and marked ther... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
pub... | Java | ["3 2\n.*\n..\n**", "3 3\n*.*\n*..\n..."] | 2 seconds | ["1 1", "2 3"] | null | Java 6 | standard input | [
"implementation",
"geometry",
"brute force"
] | e344de8280fb607c556671db9cfbaa9e | The first line contains two space-separated integers n and m (2ββ€βn,βmββ€β100) β the number of rows and columns in the table, correspondingly. Each of the next n lines contains m characters β the description of the capital's map. Each character can either be a "." (dot), or an "*" (asterisk). A character equals "*" if t... | 800 | Print two integers β the number of the row and the number of the column of the city district that is the fourth one to be robbed. The rows are numbered starting from one from top to bottom and the columns are numbered starting from one from left to right. | standard output | |
PASSED | 58f048554e5ff91c83e74679acf970ea | train_001.jsonl | 1334934300 | The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.The Berland capital's map is represented by an nβΓβm rectangular table. Each cell of the table on the map represents some districts of the capital. The capital's main detective Polycarpus took a map and marked ther... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out ... | Java | ["3 2\n.*\n..\n**", "3 3\n*.*\n*..\n..."] | 2 seconds | ["1 1", "2 3"] | null | Java 6 | standard input | [
"implementation",
"geometry",
"brute force"
] | e344de8280fb607c556671db9cfbaa9e | The first line contains two space-separated integers n and m (2ββ€βn,βmββ€β100) β the number of rows and columns in the table, correspondingly. Each of the next n lines contains m characters β the description of the capital's map. Each character can either be a "." (dot), or an "*" (asterisk). A character equals "*" if t... | 800 | Print two integers β the number of the row and the number of the column of the city district that is the fourth one to be robbed. The rows are numbered starting from one from top to bottom and the columns are numbered starting from one from left to right. | standard output | |
PASSED | d35564924d05f26d79c68add895cf548 | train_001.jsonl | 1334934300 | The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.The Berland capital's map is represented by an nβΓβm rectangular table. Each cell of the table on the map represents some districts of the capital. The capital's main detective Polycarpus took a map and marked ther... | 256 megabytes | import java.awt.Point;
import java.io.*;
public class Main {
public static void main(String[] args) {
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
try {
String[] data = br.readLine().split(" ");
int n = Integer.parseInt(data[0]);
Point[] coords = new Point[4];
int off... | Java | ["3 2\n.*\n..\n**", "3 3\n*.*\n*..\n..."] | 2 seconds | ["1 1", "2 3"] | null | Java 6 | standard input | [
"implementation",
"geometry",
"brute force"
] | e344de8280fb607c556671db9cfbaa9e | The first line contains two space-separated integers n and m (2ββ€βn,βmββ€β100) β the number of rows and columns in the table, correspondingly. Each of the next n lines contains m characters β the description of the capital's map. Each character can either be a "." (dot), or an "*" (asterisk). A character equals "*" if t... | 800 | Print two integers β the number of the row and the number of the column of the city district that is the fourth one to be robbed. The rows are numbered starting from one from top to bottom and the columns are numbered starting from one from left to right. | standard output | |
PASSED | 509c09522547efe2862384a71e8c9b20 | train_001.jsonl | 1334934300 | The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.The Berland capital's map is represented by an nβΓβm rectangular table. Each cell of the table on the map represents some districts of the capital. The capital's main detective Polycarpus took a map and marked ther... | 256 megabytes | import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
int n,m;
Scanner sc = new Scanner(System.in);
n=sc.nextInt();
m=sc.nextInt();
char mas [][] = new char[n][m];
for(int i=0;i<n;i++)
{
String S = sc.next();... | Java | ["3 2\n.*\n..\n**", "3 3\n*.*\n*..\n..."] | 2 seconds | ["1 1", "2 3"] | null | Java 6 | standard input | [
"implementation",
"geometry",
"brute force"
] | e344de8280fb607c556671db9cfbaa9e | The first line contains two space-separated integers n and m (2ββ€βn,βmββ€β100) β the number of rows and columns in the table, correspondingly. Each of the next n lines contains m characters β the description of the capital's map. Each character can either be a "." (dot), or an "*" (asterisk). A character equals "*" if t... | 800 | Print two integers β the number of the row and the number of the column of the city district that is the fourth one to be robbed. The rows are numbered starting from one from top to bottom and the columns are numbered starting from one from left to right. | standard output | |
PASSED | 7ac7080b3855b8b03bd4af43b62e6f27 | train_001.jsonl | 1334934300 | The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.The Berland capital's map is represented by an nβΓβm rectangular table. Each cell of the table on the map represents some districts of the capital. The capital's main detective Polycarpus took a map and marked ther... | 256 megabytes |
import java.util.Scanner;
public class KK {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
int f = 0;
Point[] ans = new Point[4];
for (int i = 0; i < x; i++) {
String s = sc.next... | Java | ["3 2\n.*\n..\n**", "3 3\n*.*\n*..\n..."] | 2 seconds | ["1 1", "2 3"] | null | Java 6 | standard input | [
"implementation",
"geometry",
"brute force"
] | e344de8280fb607c556671db9cfbaa9e | The first line contains two space-separated integers n and m (2ββ€βn,βmββ€β100) β the number of rows and columns in the table, correspondingly. Each of the next n lines contains m characters β the description of the capital's map. Each character can either be a "." (dot), or an "*" (asterisk). A character equals "*" if t... | 800 | Print two integers β the number of the row and the number of the column of the city district that is the fourth one to be robbed. The rows are numbered starting from one from top to bottom and the columns are numbered starting from one from left to right. | standard output | |
PASSED | 82f9f080ffa42429962b06b53b0bc3fc | train_001.jsonl | 1334934300 | The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.The Berland capital's map is represented by an nβΓβm rectangular table. Each cell of the table on the map represents some districts of the capital. The capital's main detective Polycarpus took a map and marked ther... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public void solve( ) throws Throwable {
int rows = in.nextInt( ), cols = in.nextInt( );
char mat[ ][ ] = new char[ rows ][ ];
for ( int i = 0; i < mat.length; ++i ) {
mat[ i ] = in.next( ).toCharArray( );
}
... | Java | ["3 2\n.*\n..\n**", "3 3\n*.*\n*..\n..."] | 2 seconds | ["1 1", "2 3"] | null | Java 6 | standard input | [
"implementation",
"geometry",
"brute force"
] | e344de8280fb607c556671db9cfbaa9e | The first line contains two space-separated integers n and m (2ββ€βn,βmββ€β100) β the number of rows and columns in the table, correspondingly. Each of the next n lines contains m characters β the description of the capital's map. Each character can either be a "." (dot), or an "*" (asterisk). A character equals "*" if t... | 800 | Print two integers β the number of the row and the number of the column of the city district that is the fourth one to be robbed. The rows are numbered starting from one from top to bottom and the columns are numbered starting from one from left to right. | standard output | |
PASSED | fa2a7a6973a6e2627cf4825b9589c479 | train_001.jsonl | 1334934300 | The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.The Berland capital's map is represented by an nβΓβm rectangular table. Each cell of the table on the map represents some districts of the capital. The capital's main detective Polycarpus took a map and marked ther... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;
public class Main {
public static void main(String[] args) throws IOException
{
(new Main()).solve();
}
public void Main() {
}
void solve() throws IOException {
//BufferedReader in = new Buffe... | Java | ["3 2\n.*\n..\n**", "3 3\n*.*\n*..\n..."] | 2 seconds | ["1 1", "2 3"] | null | Java 6 | standard input | [
"implementation",
"geometry",
"brute force"
] | e344de8280fb607c556671db9cfbaa9e | The first line contains two space-separated integers n and m (2ββ€βn,βmββ€β100) β the number of rows and columns in the table, correspondingly. Each of the next n lines contains m characters β the description of the capital's map. Each character can either be a "." (dot), or an "*" (asterisk). A character equals "*" if t... | 800 | Print two integers β the number of the row and the number of the column of the city district that is the fourth one to be robbed. The rows are numbered starting from one from top to bottom and the columns are numbered starting from one from left to right. | standard output | |
PASSED | 8081d8da35a979e8ebee8991ed5084a2 | train_001.jsonl | 1334934300 | The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.The Berland capital's map is represented by an nβΓβm rectangular table. Each cell of the table on the map represents some districts of the capital. The capital's main detective Polycarpus took a map and marked ther... | 256 megabytes | import java.util.Scanner;
public class CROC_1012_A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int x[] = new int[3];
int y[] = new int[3];
int k = 0;
for (int i = 0; i < n; i++) {
String s = sc.next(); sc.nextLine();
// ... | Java | ["3 2\n.*\n..\n**", "3 3\n*.*\n*..\n..."] | 2 seconds | ["1 1", "2 3"] | null | Java 6 | standard input | [
"implementation",
"geometry",
"brute force"
] | e344de8280fb607c556671db9cfbaa9e | The first line contains two space-separated integers n and m (2ββ€βn,βmββ€β100) β the number of rows and columns in the table, correspondingly. Each of the next n lines contains m characters β the description of the capital's map. Each character can either be a "." (dot), or an "*" (asterisk). A character equals "*" if t... | 800 | Print two integers β the number of the row and the number of the column of the city district that is the fourth one to be robbed. The rows are numbered starting from one from top to bottom and the columns are numbered starting from one from left to right. | standard output | |
PASSED | 99455ed6bdb3b8cf090970d486b38a94 | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
public class Solution{
static int id = 1;
public static void dfs(int curr,List<List<Integer>> adj, int[] ids, int[] lows,Stack<Integer> stack, int[] onStack, List<List<Integer>> sccs){
ids[curr] = Solution.id;... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | fc75ca89aea7e096451ec03430c51122 | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class Main {
static ArrayList<Integer> a[] = new ArrayList[100005];
static int []cost = new int[100005];// = new int[26];
static int []low = new int[100005];... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 82d6cb53dec17a57138a36617954864d | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 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.PrintStream;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Stack;
import java.util.ArrayList... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 089e2c09e5082afb97c394d14336794d | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
// 21:49.030
public class cf302218b {
public static void main(String[] args) throws IOException {
int n = ri(), cost[] = ria(n), m = ri();
Graph g = graph(n, m);
List<List<Integer>> sc... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 00ca9e43ec85363e081771702c0119ae | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main
{
int n,cost[],time;
Pair exit[];
ArrayList<Integer> list[],revlist[];
boolean visited[];
long ans,cnt;
final long mod=(long)(1e9+7);
private void solve()throws IOException
{
n=nextInt();
cost=new int[n+1];
for(int i=1;i<=n;i++)
cost[i]=nextInt();... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 59d8dcb5972f72d39ec13d2377457794 | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Stack;
public class Solution {
public static void topodfs(int src , HashMap<Integer , ArrayList<Integer>> map , Stack<Integer> st , HashSet<Integer> vis){
vis.add(src);
for(i... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 11d0661925ef0ff9f3238ac754db2f60 | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
public static void main(String sp[])throws IOException{
//Scanner sc = new Scanner(System.in);
FastReader sc = new FastReader();
int n = sc.nex... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 7147cada5b6a24f625f93ad1c79f73bd | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
public static void main(String sp[])throws IOException{
//Scanner sc = new Scanner(System.in);
FastReader sc = new FastReader();
int n = sc.nex... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 95b0f9360971ce50518c7d7e1a3d7fc1 | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.LinkedList;
// This class represents a directed graph using adjacency list
// representation
public class Graph
{
private int V; // No. of vertices
private LinkedList<Integer> adj[]; //Adjacency List
//Constructor
Graph(int v)
{
V = v;
adj =... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 58caadc2dcbcca59a6dfd20d753122a4 | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | //package com.company;
import java.util.*;
public class Main {
public static void main(String[] args) {
// write your code here
Scanner in = new Scanner(System.in);
int t1=1;
while(t1>0){
int n = in.nextInt();
int[] cost = new int[n];
for(int i=0;... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 46583a0d22b777bb7ea24a13bb1ceb35 | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | //package com.company;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.sql.SQLOutput;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner s = new Scanner(System.i... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 2ae7e88cfdb47887596599a8c7892c6d | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Checkposts {
private int time;
ArrayList<Integer> stack;
public static void main(Stri... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | b1a03830159c05bcdebdb5245a9f21b3 | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Checkposts {
private int time;
ArrayList<Integer> stack;
public static void main(Stri... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 39bb4d8e18ad998e308a61b97bdfa9b8 | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Checkposts {
public static void main(String[] args) throws IOException {
BufferedRead... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 5c7a3b62f27fa09f76c88aa900c2c595 | train_001.jsonl | 1399044600 | Your city has n junctions. There are m one-way roads between the junctions. As a mayor of the city, you have to ensure the security of all the junctions.To ensure the security, you have to build some police checkposts. Checkposts can only be built in a junction. A checkpost at junction i can protect junction j if eithe... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.Set;
import java.util.InputMismatchException;
import java.util.HashMap;
import java.io.IOException;
import java.util.Stack;
import java.util.ArrayList;
import java... | Java | ["3\n1 2 3\n3\n1 2\n2 3\n3 2", "5\n2 8 0 6 0\n6\n1 4\n1 3\n2 4\n3 4\n4 5\n5 1", "10\n1 3 2 2 1 3 1 4 10 10\n12\n1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n5 7\n6 4\n7 3\n8 9\n9 10\n10 9", "2\n7 91\n2\n1 2\n2 1"] | 2 seconds | ["3 1", "8 2", "15 6", "7 1"] | null | Java 11 | standard input | [
"two pointers",
"dfs and similar",
"graphs"
] | ee576fd64305ab99b2e0442aad6199d8 | In the first line, you will be given an integer n, number of junctions (1ββ€βnββ€β105). In the next line, n space-separated integers will be given. The ith integer is the cost of building checkpost at the ith junction (costs will be non-negative and will not exceed 109). The next line will contain an integer mΒ (0ββ€βmββ€β3... | 1,700 | Print two integers separated by spaces. The first one is the minimum possible money needed to ensure the security of all the junctions. And the second one is the number of ways you can ensure the security modulo 1000000007 (109β+β7). | standard output | |
PASSED | 4b85e344bc6721980af21e04aa6846f3 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes |
//package q1;
import java.util.*;
public final class Q1 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int[n],max=Integer.MIN_VALUE,index=0,b_r=0,b_l=0,l,r;
for(int i=0;i<n;i++)
{
a[i]=sc.nextInt();
... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 3cf6386611bacd586f5053fceaa5f8bd | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.Scanner;
public class Pillars {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int i;
int[] ar= new int[n];
for(i=0;i<n;i++)
ar[i]=in.nextInt();
int d = n/2;
// d--;
// if(n%2!=0)
// d++;
//
int c=1;
if(n%2!=0)
c=... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | e60ccf765c47725cf60a22e4a4da2c44 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.*;
import java.io.*;
public class Ladder {
public static void main(String args[] ) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
OutputStream outputStream = System.out;
PrintWriter out = new PrintWriter(outputStream);
int... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 5a239700b15030a32c198f68a0c8d4d4 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
public class Pillars
{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int []pil=new int[n];
HashMap<Integer,Integer> hashMap=new HashMap<>()... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 6fab8e46c77d72b67edcb3fd8c3b9e23 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.*;
public class Main
{
public static void main (String[] args)
{
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] a = new int[n];
int i, max=0, x=-1;
for(i=0;i<n;i++){
a[i]=in.nextInt();
if(a[i]>max){
... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 789b34549cfed6a57be5386fa9f81e67 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.Scanner;
public class pre21
{
public static void main(String args[])
{
Scanner obj = new Scanner(System.in);
int n = obj.nextInt();
int[] arr = new int[n];
int max = Integer.MIN_VALUE,index=-1;
for(int i=0;i<n;i++)
{
arr[i] = obj.next... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 62c446a70c71f3ad22d8ab3fdef62f7e | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Jenish
*/
public class Ma... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | f9442a39173fc85b8a4cde6bcaff42c0 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class Exam {
public static long mod = (long) Math.pow(10, 9)+7 ;
public static InputReader sc = new InputReader(System.in);
public static PrintWriter pw = new PrintWriter(System.out);
public static int countSetBits(int n)
{
... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 7534c30c6d81591208dc95efd6efcf73 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.zip.Inflater;
public class Main {
private static AWriter writer = new AWriter(System.out);
private static AReader reader = new AReader(System.in);
... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 20c7f606e49e606ef7710b595241b48d | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.*;
import java.util.*;
public class tr1 {
static PrintWriter out;
static StringBuilder sb;
static int inf = (int) 1e9;
static int mod = (int) 1e9 + 7;
static int[] si;
static ArrayList<Integer> primes;
static HashSet<Integer> pr;
static int n, k, m;
static boolean[] in;
static HashMap<Integer,... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 84d1f7b7140f1545a9fa4d40b2e92342 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.*;
public class A{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int[n+1];
int j=0,max=0;
for(int i=1;i<n+1;i++){
int num=sc.nextInt();
a[num]=i;
}
int left=0... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | bfb71600c689c945927d6743a592359f | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.*;
public class A{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a[]=new int[n+1];
int j=0,max=0;
for(int i=1;i<n+1;i++){
a[sc.nextInt()]=i;
}
int left=0,right=0;
boolean... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 44fcbc226945f8d19a4f622fc9d3a2da | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
//@Manan Parmar
public class Solution2 implements Runnable {
public void run() {
InputReader sc = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
int n=sc.nextInt(... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | aeb8b612d726a8b0a1a34e244de12df9 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class cf2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
int[] arr1 = new int[n];
int[] arr2 = new int[n];
int[] arr3 = new int[n];... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | b229df1d6eb1caa6d6aea02c3dc0230c | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes |
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class Contest {
//private static List<Integer> results = new ArrayList<>();
//private static Map<Integer, List<Integer>> map = new HashMap<>();
/**
* @param args the command line arguments
*/
public static void... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 669982c598b1d9b61768878718e1c04c | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.*;
public class B {
static Scanner sc = new Scanner(System.in);
static int[] inx;
static int[] a;
public static void main(String[] args) {
int n = sc.nextInt();
a = new int[n];
int max = 0, maxInx = 0;
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
// System.out.println(a[i]);
... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | fe5219097743cdc1b50bf91c86b27c8c | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
int pp = -1;
for(int i = 0; i<n ; i++) {
a[i] = sc.nextInt();
if(a[i] == n) pp = i... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 705d22230f4c1091bc8fb5ff2f8d135b | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc= new Scanner(System.in);
Pr... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 86012d826524dff6aedf7bc4b1fbd083 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class Main {
public static PrintWri... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 33807166cd7da3d1d7eb5d2f25dd709a | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
FastReader() {
br = new BufferedReader(new InputStreamReader(System.in)); }
String next() {
while (st == null || !st.hasMoreElements()) ... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 4a24df5184440c39db91666a4771b494 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static class FastReader {
BufferedReader br;
StringTokenizer st;
FastReader() {
br = new BufferedReader(new InputStreamReader(System.in)); }
String next() {
while (st == null || !st.hasMoreElements()) ... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 2b2b0c1f9488ccd9831a175a84bebe3d | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.*;
import static java.lang.Double.max;
import static java.lang.Math.pow;
import java.util.*;
/**
*
* @author Mohammed M Elkady
*/
public class Mamo {
static long ans,sum,sum2,max;
static StringBuilder Sd=new StringBuilder();
static FastReader in=new FastReader();
static long n,m;
public static voi... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | b1ea81cf74d2161cdacc0daa1b20aff7 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes |
import java.io.*;
import static java.lang.Double.max;
import static java.lang.Math.pow;
import java.util.*;
/**
*
* @author Mohammed M Elkady
*/
public class Mamo {
static long ans,sum,sum2,max;
static StringBuilder Sd=new StringBuilder();
static FastReader in=new FastReader();
static long n,m;
public static vo... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | b5ef4efc9b058d5f7a91f255dca15eaf | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class pillars {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 22a920c06883960760fdab8d06b79a48 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.*;
import java.io.*;
public class A {
public static void main(String args[]) {
FastScanner in = new FastScanner();
int n=in.nextInt();
int a[]=in.nextArray(n);
int ctr=0;
int i=0,j=n-1;
for(;i<n-1;i++) {
if(a[i]>a[i+1]) {
break;
}
}
for(;j>0;j--) {
if(a[j]>a[j-1]) {
br... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 413d3e2f654fa18e14af0619de37aa25 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.*;
public class test
{
public static void main(String args[])
{
Scanner s = new Scanner(System.in);
int n=s.nextInt();
int arr1[]=new int[n];
int arr2[]=new int[n+1];
int max_index=0;
for(int i=0;i<n+1;i++)
{
arr2[i]=0;
... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 9d042b7b4975692c8add6eef97c8eacc | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.*;
import java.util.*;
public class b2{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int A[]=new int[n];
int g=0,m=-1;
for(int i=0;i<n;i++){
A[i]=sc.nextInt();
if(A[i]>g){
g=A[i];
m=i;
}
}
int l,r;
int t=1;
for(in... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 616d653102c4f2062c565ba94318f355 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class CF1197B {
public static void main(String[] args) {
FastReader input = new FastReader();
int n = input.nextInt();
int[] arr = new int[n];
int ma... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 7ee5370d28b44b2321f482009199d4f0 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.Scanner;
public class codeforces {
public static void solution(int [] arr) {
int max=0;
int index=0;
for(int i=0;i<arr.length;i++) {
if(arr[i]>max) {
max=arr[i];
index=i;
}
}
boolean isSorted=true;
for(int i=0;i<index;i++) {
if(arr[i]>=arr[i+1]) {
isSorted=false;
... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 31e1a7dddf1c0a64e709603e101f687c | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class a{
static int[] count,count1;
static long[] arr;
static char[] ch,ch1;
static long[] darr;
static long[][] mat,mat1;
static long... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 5c0ea1f93fad2427f1c413e7fe8859aa | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | /*
9 2
1 1 1 1 1 0 0 0 0
1 2
1 5
5 6
5 7
2 3
2 4
3 8
3 9
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 07a1ef9ad240aab9dcbce129ffa968b4 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | /*
* @Author: Kaustav Vats
*/
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
public class PB {
public static void main(String[] args) throws IOException{
Reader.init(System.in);
int N = Reader.nextInt();
Node Arr = new Node(Reader.nextInt());
Nod... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 6f55d33a85e2eb518918397c03634b60 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
i... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | c1c5365e9b41d9e4bdea316d9adcd712 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Pillars {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
ArrayList<Integer> arrayList = new ArrayList<>(n);
int max = Integer.MIN_VALUE, maxIndex = 0;
... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 3c398e7bdf57ea1503bfb3a8b06657ed | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class pillars {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
diskSet[] arr = new diskSet[n];
diskSet[] unsortedArr = new diskSet[n];
for (int i = 0; i < n; i++) {
... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 0a7418225050af1824b43ef73c5f8c89 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import static java.lang.Math.*;
public class Main {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader br = new BufferedReader(new FileReader("input.txt"));
StringTokenizer st = new StringTokenize... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 997012f836ffd2d3a8f303a2667c1c45 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.Scanner;
public class HelloWorld{
public static void main(String []args){
Scanner obj= new Scanner(System.in);
int n= obj.nextInt();
int[] list= new int[n];
int highestv=0;
int highest=0;
for(int i=0;i<n;i++){
int current=obj.nextInt();
... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 708c007056ace8d2498b4b68c6b407af | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.io.InputStreamReader;
import java.util.Scanner;
public class Pillars {
public static void main(String[] args) {
Scanner sc = new Scanner(new InputStreamReader(System.in));
int numPillars = sc.nextInt();
int[] length = new int[numPillars];
int maxIndex = 0;
int ... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 9e6975c0740ff8701ef350b9b1888065 | train_001.jsonl | 1563806100 | There are $$$n$$$ pillars aligned in a row and numbered from $$$1$$$ to $$$n$$$.Initially each pillar contains exactly one disk. The $$$i$$$-th pillar contains a disk having radius $$$a_i$$$.You can move these disks from one pillar to another. You can take a disk from pillar $$$i$$$ and place it on top of pillar $$$j$$... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int apred = sc.nextInt();
if (apred == n) {
for (int j = 1; j < n; j++) {
int a = sc.nextInt();
if (a > apred) {
System.out.println("NO");
ret... | Java | ["4\n1 3 4 2", "3\n3 1 2"] | 1.5 seconds | ["YES", "NO"] | NoteIn the first case it is possible to place all disks on pillar $$$3$$$ using the following sequence of actions: take the disk with radius $$$3$$$ from pillar $$$2$$$ and place it on top of pillar $$$3$$$; take the disk with radius $$$1$$$ from pillar $$$1$$$ and place it on top of pillar $$$2$$$; take the disk wi... | Java 8 | standard input | [
"implementation",
"greedy"
] | 12abfbe7118868a0b1237489b5c92760 | The first line contains one integer $$$n$$$ ($$$3 \le n \le 2 \cdot 10^5$$$) β the number of pillars. The second line contains $$$n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_i$$$ ($$$1 \le a_i \le n$$$), where $$$a_i$$$ is the radius of the disk initially placed on the $$$i$$$-th pillar. All numbers $$$a_i$$$ are dis... | 1,000 | Print YES if it is possible to place all the disks on the same pillar simultaneously, and NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer). | standard output | |
PASSED | 71ad1b681622d56389ea90a72470fb18 | train_001.jsonl | 1335614400 | Offering the ABBYY Cup participants a problem written by the Smart Beaver is becoming a tradition. He proposed the following problem.You are given a monochrome image, that is, an image that is composed of two colors (black and white). The image is given in raster form, that is, as a matrix of pixels' colors, and the ma... | 256 megabytes | import java.io.*;
import java.util.*;
public class E implements Runnable {
private MyScanner in;
private PrintWriter out;
final int[] dx = { -1, 0, 1, 0 };
final int[] dy = { 0, -1, 0, 1 };
int n;
int[][] map;
boolean[][] seen;
Deque<Integer> queue;
boolean valid(int x, int y) {
... | Java | [] | 5 seconds | [] | NoteYou are given a sample of original data for each difficulty level. The samples are available at http://codeforces.ru/static/materials/contests/178/e-samples.zip . | Java 6 | standard input | [] | 06c7699523a9f8036330857660c0687e | The first input line contains a single integer n (1000ββ€βnββ€β2000), which is the length and the width of the original image. Next n lines describe the matrix of colors of the image pixels. The i-th line contains exactly n integers aij (0ββ€βaijββ€β1), separated by spaces. Value of aijβ=β0 corresponds to a white pixel an... | 1,900 | Print exactly two integers, separated by a single space β the number of circles and the number of squares in the given image, correspondingly. | standard output | |
PASSED | 3a7dbcff9cba159636c48a462184a8fd | train_001.jsonl | 1335614400 | Offering the ABBYY Cup participants a problem written by the Smart Beaver is becoming a tradition. He proposed the following problem.You are given a monochrome image, that is, an image that is composed of two colors (black and white). The image is given in raster form, that is, as a matrix of pixels' colors, and the ma... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution implements Runnable {
private StringTokenizer st;
private BufferedReader in;
private PrintWriter out;
long count;
long sumx;
long sumy;
double mind, maxd;
private void cDfs(int i, int j, boolean[][] b, boolean[][] col) {
if (i < 0 || i >= b.le... | Java | [] | 5 seconds | [] | NoteYou are given a sample of original data for each difficulty level. The samples are available at http://codeforces.ru/static/materials/contests/178/e-samples.zip . | Java 6 | standard input | [] | 06c7699523a9f8036330857660c0687e | The first input line contains a single integer n (1000ββ€βnββ€β2000), which is the length and the width of the original image. Next n lines describe the matrix of colors of the image pixels. The i-th line contains exactly n integers aij (0ββ€βaijββ€β1), separated by spaces. Value of aijβ=β0 corresponds to a white pixel an... | 1,900 | Print exactly two integers, separated by a single space β the number of circles and the number of squares in the given image, correspondingly. | standard output | |
PASSED | f33733cf179d351072da3dfc437c325d | train_001.jsonl | 1335614400 | Offering the ABBYY Cup participants a problem written by the Smart Beaver is becoming a tradition. He proposed the following problem.You are given a monochrome image, that is, an image that is composed of two colors (black and white). The image is given in raster form, that is, as a matrix of pixels' colors, and the ma... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution implements Runnable {
private StringTokenizer st;
private BufferedReader in;
private PrintWriter out;
long count;
long sumx;
long sumy;
double mind, maxd;
private void cDfs(int i, int j, boolean[][] b, boolean[][] col) {
if (i < 0 || i >= b.le... | Java | [] | 5 seconds | [] | NoteYou are given a sample of original data for each difficulty level. The samples are available at http://codeforces.ru/static/materials/contests/178/e-samples.zip . | Java 6 | standard input | [] | 06c7699523a9f8036330857660c0687e | The first input line contains a single integer n (1000ββ€βnββ€β2000), which is the length and the width of the original image. Next n lines describe the matrix of colors of the image pixels. The i-th line contains exactly n integers aij (0ββ€βaijββ€β1), separated by spaces. Value of aijβ=β0 corresponds to a white pixel an... | 1,900 | Print exactly two integers, separated by a single space β the number of circles and the number of squares in the given image, correspondingly. | standard output | |
PASSED | a28385b3bf9e98baadfca6a4365ca98c | train_001.jsonl | 1335614400 | Offering the ABBYY Cup participants a problem written by the Smart Beaver is becoming a tradition. He proposed the following problem.You are given a monochrome image, that is, an image that is composed of two colors (black and white). The image is given in raster form, that is, as a matrix of pixels' colors, and the ma... | 256 megabytes | import java.io.*;
import java.util.*;
public class Solution implements Runnable {
private StringTokenizer st;
private BufferedReader in;
private PrintWriter out;
long count;
long sumx;
long sumy;
double mind, maxd;
private void cDfs(int i, int j, boolean[][] b, boolean[][] col) {
if (i < 0 || i >= b.le... | Java | [] | 5 seconds | [] | NoteYou are given a sample of original data for each difficulty level. The samples are available at http://codeforces.ru/static/materials/contests/178/e-samples.zip . | Java 6 | standard input | [] | 06c7699523a9f8036330857660c0687e | The first input line contains a single integer n (1000ββ€βnββ€β2000), which is the length and the width of the original image. Next n lines describe the matrix of colors of the image pixels. The i-th line contains exactly n integers aij (0ββ€βaijββ€β1), separated by spaces. Value of aijβ=β0 corresponds to a white pixel an... | 1,900 | Print exactly two integers, separated by a single space β the number of circles and the number of squares in the given image, correspondingly. | standard output | |
PASSED | d67f99e510ad23ded3a1fd4efbfbf3cf | train_001.jsonl | 1335614400 | Offering the ABBYY Cup participants a problem written by the Smart Beaver is becoming a tradition. He proposed the following problem.You are given a monochrome image, that is, an image that is composed of two colors (black and white). The image is given in raster form, that is, as a matrix of pixels' colors, and the ma... | 256 megabytes | import java.io.*;
import java.util.*;
/*
*
* E.java
* Written by Andy Huang: 9:57:38 AM Apr 28, 2012
*/
public class E {
static boolean img[][];
static final int d[][] = { { 0, 1 }, { 1, 0 }, { 0, -1 }, { -1, 0 } };
static void solve() {
int n = in.nInt();
img = new boolean[n + 2][n + 2];
int sq = 0;
... | Java | [] | 5 seconds | [] | NoteYou are given a sample of original data for each difficulty level. The samples are available at http://codeforces.ru/static/materials/contests/178/e-samples.zip . | Java 6 | standard input | [] | 06c7699523a9f8036330857660c0687e | The first input line contains a single integer n (1000ββ€βnββ€β2000), which is the length and the width of the original image. Next n lines describe the matrix of colors of the image pixels. The i-th line contains exactly n integers aij (0ββ€βaijββ€β1), separated by spaces. Value of aijβ=β0 corresponds to a white pixel an... | 1,900 | Print exactly two integers, separated by a single space β the number of circles and the number of squares in the given image, correspondingly. | standard output | |
PASSED | 5524cb1608e7adf03976e57c3230fff2 | train_001.jsonl | 1335614400 | Offering the ABBYY Cup participants a problem written by the Smart Beaver is becoming a tradition. He proposed the following problem.You are given a monochrome image, that is, an image that is composed of two colors (black and white). The image is given in raster form, that is, as a matrix of pixels' colors, and the ma... | 256 megabytes | //package abbyy2.hard;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
public class ES2 {
BufferedReader br;
PrintWriter out;
String INPUT = "";
void solve() throws E... | Java | [] | 5 seconds | [] | NoteYou are given a sample of original data for each difficulty level. The samples are available at http://codeforces.ru/static/materials/contests/178/e-samples.zip . | Java 6 | standard input | [] | 06c7699523a9f8036330857660c0687e | The first input line contains a single integer n (1000ββ€βnββ€β2000), which is the length and the width of the original image. Next n lines describe the matrix of colors of the image pixels. The i-th line contains exactly n integers aij (0ββ€βaijββ€β1), separated by spaces. Value of aijβ=β0 corresponds to a white pixel an... | 1,900 | Print exactly two integers, separated by a single space β the number of circles and the number of squares in the given image, correspondingly. | standard output | |
PASSED | f444f01da6280fe0c1a6cb305460974d | train_001.jsonl | 1335614400 | Offering the ABBYY Cup participants a problem written by the Smart Beaver is becoming a tradition. He proposed the following problem.You are given a monochrome image, that is, an image that is composed of two colors (black and white). The image is given in raster form, that is, as a matrix of pixels' colors, and the ma... | 256 megabytes |
import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import static java.lang.Math.*;
public class E implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
public static void main(String[] args) {
new Threa... | Java | [] | 5 seconds | [] | NoteYou are given a sample of original data for each difficulty level. The samples are available at http://codeforces.ru/static/materials/contests/178/e-samples.zip . | Java 6 | standard input | [] | 06c7699523a9f8036330857660c0687e | The first input line contains a single integer n (1000ββ€βnββ€β2000), which is the length and the width of the original image. Next n lines describe the matrix of colors of the image pixels. The i-th line contains exactly n integers aij (0ββ€βaijββ€β1), separated by spaces. Value of aijβ=β0 corresponds to a white pixel an... | 1,900 | Print exactly two integers, separated by a single space β the number of circles and the number of squares in the given image, correspondingly. | standard output | |
PASSED | f7cb0ae1fc56209d27e6ba92b2b7e1e2 | train_001.jsonl | 1335614400 | Offering the ABBYY Cup participants a problem written by the Smart Beaver is becoming a tradition. He proposed the following problem.You are given a monochrome image, that is, an image that is composed of two colors (black and white). The image is given in raster form, that is, as a matrix of pixels' colors, and the ma... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Locale;
import java.util.Stack;
import java.... | Java | [] | 5 seconds | [] | NoteYou are given a sample of original data for each difficulty level. The samples are available at http://codeforces.ru/static/materials/contests/178/e-samples.zip . | Java 6 | standard input | [] | 06c7699523a9f8036330857660c0687e | The first input line contains a single integer n (1000ββ€βnββ€β2000), which is the length and the width of the original image. Next n lines describe the matrix of colors of the image pixels. The i-th line contains exactly n integers aij (0ββ€βaijββ€β1), separated by spaces. Value of aijβ=β0 corresponds to a white pixel an... | 1,900 | Print exactly two integers, separated by a single space β the number of circles and the number of squares in the given image, correspondingly. | standard output | |
PASSED | 596ccbbf89d985c60dfcfa901b98552e | train_001.jsonl | 1335614400 | Offering the ABBYY Cup participants a problem written by the Smart Beaver is becoming a tradition. He proposed the following problem.You are given a monochrome image, that is, an image that is composed of two colors (black and white). The image is given in raster form, that is, as a matrix of pixels' colors, and the ma... | 256 megabytes | import java.io.*;
import java.util.*;
public class E2{
public static void main(String ar[]){
try{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
//BufferedReader in=new BufferedReader(new FileReader("e-samples\\easy_2.in"));
int n=Integer.parseInt(in.readLine());
int q=0;
int... | Java | [] | 5 seconds | [] | NoteYou are given a sample of original data for each difficulty level. The samples are available at http://codeforces.ru/static/materials/contests/178/e-samples.zip . | Java 6 | standard input | [] | 06c7699523a9f8036330857660c0687e | The first input line contains a single integer n (1000ββ€βnββ€β2000), which is the length and the width of the original image. Next n lines describe the matrix of colors of the image pixels. The i-th line contains exactly n integers aij (0ββ€βaijββ€β1), separated by spaces. Value of aijβ=β0 corresponds to a white pixel an... | 1,900 | Print exactly two integers, separated by a single space β the number of circles and the number of squares in the given image, correspondingly. | standard output | |
PASSED | ac3fb0ca67e4ca60f47c42a1a2b414af | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;
public class Main implements Runnable {
static final int MOD = (int) 1e9 + 7;
static final int MI = (int) 1e9;
static final long ML = (long) 1e18;
static final Reader in = new Reader();
static f... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | ae0d219a9c69612c0e5b549e0ececd71 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | f903cb59d84a95279bef72985bb98645 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.util.*;
import java.io.*;
public class P297A {
private static void solve() {
char[] c1 = next().toCharArray();
char[] c2 = next().toCharArray();
int cnt1 = 0;
for (int i = 0; i < c1.length; i++) {
if (c1[i] == '1') cnt1++;
}
int cnt2 = 0;
for (int i = 0; i < c2.length... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | f9335a486ed34c202298b85ffcfdf1c1 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.StringTokenizer;
// knuth-moris-pattrn string matching algorithm
public class Main {
public static void main(String args[])throws Exception
{
... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | bef57912ae43c5d2826f291cfd43b079 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main extends PrintWriter {
BufferedReader in;
StringTokenizer stok;
final Random rand = new Random(31);
final int inf = (int) 1e9;
final long linf = (long) 1e18;
final static String IO = "_std";
int k1(cha... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | dd83d7f1b629741461dec4b380660573 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public ... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | d35ab5eae108cdaa4c837faace1495c1 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.util.Scanner;
public class A297 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int count = 0;
char[] s = in.next().toCharArray();
char[] n = in.next().toCharArray();
for (int i = 0; i < s.length; ++i) {
count += s[i] ... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | f38497877b2109422d731a48b30969ce | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.*;
import java.util.*;
public class Template implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws FileNotFoundException {
try {
in = new BufferedReader(new FileReader("input.txt"));
o... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | 76375779748dcc261b884cc4edaf0061 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author mthai
*/
public class Main {
public static void main(String[] args) {
InputStream inp... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | c26a650681b6cb2d105b996492edca07 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
*... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | 624df19f69ededb4857f9442c79f3667 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.util.Scanner;
public class ParityGame {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[] a = sc.next().toCharArray();
char[] b = sc.next().toCharArray();
int count = 0;
for (int i = 0; i < a.length; ++i) {
count += a[i] == '1' ? 1 : 0;
}
count += cou... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | 0e76dc8e3b16e900fbac50e6954a6a34 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.zip.ZipEntry;
import java.math.*;
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
Input in = new Input(inputStream);
PrintWriter out = new... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | d1b62c4156aae8f1e906ba0792f54a60 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
public class Main {
FastScanner in;
PrintWriter out;
static class FastScanner {
BufferedReader br;
StringTokenizer st;
FastScanner(InputStream in) {
br = new BufferedReader(new InputStreamReader(in));
... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | ccc3ff702980a252bf1d4d625b80b1b8 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
InputReader in=new InputReader(System.in);
String a=in.next();
String b=in.next();
int cA=cou... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | b479dd18146683b53915283047e0762f | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitS... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | 2a57095490f3d5a08fa7951a71333b12 | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
import java.io.*;
public class codeforces
{
static class Student{
int x,y;
Student(int x,int y){... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | 1affe848581d58649f3c10b502ea2f5c | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {
void solve() {
String a = in.next();
String b = in.next();
int cnt = 0;
for (int i = 0; i < a.length(); ++i) {
if (a.charAt(i) == '1') ++cnt;
}
if (cnt % 2 == 1) ++cnt;
for (int i = 0; i < b.length(); ++i) {
i... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output | |
PASSED | 663f1ffb42b55d893c559e15c5600b7a | train_001.jsonl | 1366385400 | You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1") a and b. Then you try to turn a into b using two types of operations: Write parity(a) to... | 256 megabytes | import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Main{
public static void main(String[] args) throws FileNotFoundException {
Scanner scanner =new Scanner(System.in);
// Scanner scanner =new Scanner(new FileInputStream("src/in.txt"));
... | Java | ["01011\n0110", "0011\n1110"] | 1 second | ["YES", "NO"] | NoteIn the first sample, the steps are as follows: 01011βββ1011βββ011βββ0110 | Java 8 | standard input | [
"constructive algorithms"
] | cf86add6c92fa8a72b8e23efbdb38613 | The first line contains the string a and the second line contains the string b (1ββ€β|a|,β|b|ββ€β1000). Both strings contain only the characters "0" and "1". Here |x| denotes the length of the string x. | 1,700 | Print "YES" (without quotes) if it is possible to turn a into b, and "NO" (without quotes) otherwise. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.