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 | 02f916697550b1eeaa008a8e0a4597f3 | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.concurrent.*;
@SuppressWarnings("unchecked")
public class P79B {
final static String [] fruits = {"Carrots", "Kiwis", "Grapes"};
public void run() throws Exception {
int n = nextInt();
int m = nextInt();
int k = nextInt();
... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | 147fa731519b4b7af9aa27050fb1de71 | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
import java.util.concurrent.*;
@SuppressWarnings("unchecked")
public class P79B {
final static String [] fruits = {"Carrots", "Kiwis", "Grapes"};
public void run() throws Exception {
int n = nextInt();
int m = nextInt();
int k = nextInt();
... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | 968bb91ebc4cc717987a866b0ddb0bdd | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | /*
* @Author: steve
* @Date: 2015-04-07 22:59:22
* @Last Modified by: steve
* @Last Modified time: 2015-04-07 23:41:09
*/
import java.io.*;
import java.util.*;
public class ColorfulField {
public static void main(String[] args) throws Exception{
BufferedReader entrada = new BufferedReader(new InputStream... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | e212cfd080839d4586c5412414da3973 | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes |
import java.awt.Point;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparato... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | f96887d14abb0b10aa989feadd44a9ec | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.util.*;
import java.io.*;
public class zanah{
public static void main(String args[]) throws IOException{
BufferedReader lector = new BufferedReader(new InputStreamReader(System.in));
String tmp[] = lector.readLine().split(" ");
int a = Integer.parseInt(tmp[0]);
int b = Integer.parseInt(tmp[1]);
int c = Inte... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | 12b25a01a0701889f1a7bfa801de116d | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 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 m = sc.nextInt();
int k = sc.nextInt();
int t = sc.nextInt();
int[][] waste = new int[k][2];
for (int i = 0; i < k; i++)
waste[i] = new int[] { sc.nex... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | 5c17e931d3a7d0d32e08c814e947c6aa | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
public class CodeC
{
s... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | 87bd20e2c5ef9523951b013babc10d78 | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.io.*;
import java.util.*;
public class ColorfulField {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(f.readLine());
int n = Integer.parseInt(st.nextToken());
int m = Inte... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | ee10eaef548d33804e00beda073630ab | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.FileReader;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | dfbadcb121dc03db8c80e024f9741d8f | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.FileReader;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.File;
import java.io.Wri... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | 4e6ba248a468da2c54cc96c4a1118099 | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.FileReader;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.File;
import java.io.Wri... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | 29121abaff495dc0d915b347b8618af9 | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.io.*;
import java.util.*;
public class test
{
public static void main(String[] args)
{
new test().run();
}
void run()
{
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = in.nextInt();
int m = in.nextInt();
int k = in.nextInt();
int t = in.next... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | 1571ee55c32d97da05c605fd9b83efcb | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int k = in.nextInt();
int t = in.n... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | a6b9fd05ecaa18765eebe3c858589b2d | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.io.*;
import java.util.*;
public final class colorful_field
{
static Scanner sc=new Scanner(System.in);
static PrintWriter out=new PrintWriter(System.out);
static final String s1="Waste",s2="Grapes",s3="Carrots",s4="Kiwis";
public static void main(String args[]) throws Exception
{
int n=sc.nextInt(... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | 5dc003e6eaf506bc043e8af69409e5aa | train_000.jsonl | 1304175600 | Fox Ciel saw a large field while she was on a bus. The field was a nβΓβm rectangle divided into 1βΓβ1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following p... | 256 megabytes | import java.io.InputStream;
import java.io.OutputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.A... | Java | ["4 5 5 6\n4 3\n1 3\n3 3\n2 5\n3 2\n1 3\n1 4\n2 3\n2 4\n1 1\n1 1"] | 2 seconds | ["Waste\nGrapes\nCarrots\nKiwis\nCarrots\nCarrots"] | NoteThe sample corresponds to the figure in the statement. | Java 7 | standard input | [
"implementation",
"sortings"
] | bfef3f835357dae290620efabe650580 | In the first line there are four positive integers n,βm,βk,βt (1ββ€βnββ€β4Β·104,β1ββ€βmββ€β4Β·104,β1ββ€βkββ€β103,β1ββ€βtββ€β103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines... | 1,400 | For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes. | standard output | |
PASSED | 1c3841e056aac48a1519605ca78eba45 | train_000.jsonl | 1366385400 | Even polar bears feel cold when lying on the ice. Therefore, a polar bear Alice is going to make a carpet. The carpet can be viewed as a grid with height h and width w. Then the grid is divided into hβΓβw squares. Alice is going to assign one of k different colors to each square. The colors are numbered from 1 to k. Sh... | 256 megabytes | import static java.util.Arrays.deepToString;
import java.io.*;
import java.math.*;
import java.util.*;
public class D {
static boolean[] parse() {
char[] c = next().toCharArray();
boolean[] ret = new boolean[c.length];
for (int i = 0; i < ret.length; i++) {
ret[i] = c[i] == 'E';
}
return ret;
}
stat... | Java | ["3 4 4\nENE\nNNEE\nNEE\nENEN\nENN"] | 1 second | ["YES\n1 1 2 2\n3 4 1 1\n3 3 2 4"] | null | Java 7 | standard input | [
"constructive algorithms"
] | a5f650b6f5737f654eb30f1e57ce03d6 | The first line contains three integers h,βw,βk (2ββ€βh,βwββ€β1000,β1ββ€βkββ€βwΒ·h). The next 2hβ-β1 lines describe the color constraints from top to bottom, left to right. They contain wβ-β1,βw,βwβ-β1,βw,β...,βwβ-β1 characters respectively. Each color constraint is represented by a character "E" or "N", where "E" means "β=β... | 2,500 | If there is a coloring that satisfies at least of the color constraints, print "YES" (without quotes) in the first line. In each of the next h lines, print w integers describing the coloring. Otherwise, print "NO" (without quotes). | standard output | |
PASSED | 45272f96f993289982114d6bfed69650 | train_000.jsonl | 1366385400 | Even polar bears feel cold when lying on the ice. Therefore, a polar bear Alice is going to make a carpet. The carpet can be viewed as a grid with height h and width w. Then the grid is divided into hβΓβw squares. Alice is going to assign one of k different colors to each square. The colors are numbered from 1 to k. Sh... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
static boolean[][]H,V,M;
static void output(PrintWriter out,int n,int m){
int x=-1,y;
for(out.println("YES");n>++x;out.println())
for(y=0;m>y;out.print((M[x][y++]?2:1)+" "));
}
static boolean oneColorFill(int n,int m){
int s=0,x=0,y;
for(;n>x;++x) ... | Java | ["3 4 4\nENE\nNNEE\nNEE\nENEN\nENN"] | 1 second | ["YES\n1 1 2 2\n3 4 1 1\n3 3 2 4"] | null | Java 7 | standard input | [
"constructive algorithms"
] | a5f650b6f5737f654eb30f1e57ce03d6 | The first line contains three integers h,βw,βk (2ββ€βh,βwββ€β1000,β1ββ€βkββ€βwΒ·h). The next 2hβ-β1 lines describe the color constraints from top to bottom, left to right. They contain wβ-β1,βw,βwβ-β1,βw,β...,βwβ-β1 characters respectively. Each color constraint is represented by a character "E" or "N", where "E" means "β=β... | 2,500 | If there is a coloring that satisfies at least of the color constraints, print "YES" (without quotes) in the first line. In each of the next h lines, print w integers describing the coloring. Otherwise, print "NO" (without quotes). | standard output | |
PASSED | 3bf5fc54c0ea4bb4a2c1a1c599fc3ef9 | train_000.jsonl | 1366385400 | Even polar bears feel cold when lying on the ice. Therefore, a polar bear Alice is going to make a carpet. The carpet can be viewed as a grid with height h and width w. Then the grid is divided into hβΓβw squares. Alice is going to assign one of k different colors to each square. The colors are numbered from 1 to k. Sh... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
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 jav... | Java | ["3 4 4\nENE\nNNEE\nNEE\nENEN\nENN"] | 1 second | ["YES\n1 1 2 2\n3 4 1 1\n3 3 2 4"] | null | Java 7 | standard input | [
"constructive algorithms"
] | a5f650b6f5737f654eb30f1e57ce03d6 | The first line contains three integers h,βw,βk (2ββ€βh,βwββ€β1000,β1ββ€βkββ€βwΒ·h). The next 2hβ-β1 lines describe the color constraints from top to bottom, left to right. They contain wβ-β1,βw,βwβ-β1,βw,β...,βwβ-β1 characters respectively. Each color constraint is represented by a character "E" or "N", where "E" means "β=β... | 2,500 | If there is a coloring that satisfies at least of the color constraints, print "YES" (without quotes) in the first line. In each of the next h lines, print w integers describing the coloring. Otherwise, print "NO" (without quotes). | standard output | |
PASSED | 845a5aa514fd6d1d7d31754342a1236f | train_000.jsonl | 1366385400 | Even polar bears feel cold when lying on the ice. Therefore, a polar bear Alice is going to make a carpet. The carpet can be viewed as a grid with height h and width w. Then the grid is divided into hβΓβw squares. Alice is going to assign one of k different colors to each square. The colors are numbered from 1 to k. Sh... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
public class D {
private void solve() throws IOException {
int h = nextInt();
int w = ... | Java | ["3 4 4\nENE\nNNEE\nNEE\nENEN\nENN"] | 1 second | ["YES\n1 1 2 2\n3 4 1 1\n3 3 2 4"] | null | Java 7 | standard input | [
"constructive algorithms"
] | a5f650b6f5737f654eb30f1e57ce03d6 | The first line contains three integers h,βw,βk (2ββ€βh,βwββ€β1000,β1ββ€βkββ€βwΒ·h). The next 2hβ-β1 lines describe the color constraints from top to bottom, left to right. They contain wβ-β1,βw,βwβ-β1,βw,β...,βwβ-β1 characters respectively. Each color constraint is represented by a character "E" or "N", where "E" means "β=β... | 2,500 | If there is a coloring that satisfies at least of the color constraints, print "YES" (without quotes) in the first line. In each of the next h lines, print w integers describing the coloring. Otherwise, print "NO" (without quotes). | standard output | |
PASSED | 4cacc0d6cb94b8fd9821c08556c1642e | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public clas... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | ab9fcecc9e4d157a630e668ec86acab5 | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes |
import java.io.IOException;
public class Main {
private static final String LEGEND = "Just a legend";
public static void main(String[] args) throws IOException {
byte[] input = new byte[1000002];
int size = System.in.read(input) - 2;
getResult(input, size);
}
private static v... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | 3bbc717b0b1ba1642509ced93251a862 | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | import java.util.*;
import java.io.*;
public class _0126_B_Password {
public static void main(String[] args) throws IOException {
String s = read(); int N = s.length();
int lps[] = new int[N];
for(int i = 1, j = 0; i<N; ) {
if(s.charAt(i) == s.charAt(j)) {
lps[i++] = ++j;
}
else if(j != 0) {
j... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | 904be94c7923285d77d2e3a46456a341 | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class cf126_B_Password {
public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public stati... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | 7bc60a5dc822db0c421a09e28e59e479 | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class cf126_B_Password {
public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public stati... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | 5783a917b6bb6be6dd2ef21369d5457f | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | /*
*created by Kraken on 25-04-2020 at 11:56
*/
//package com.kraken.cf.practice;
import java.util.*;
import java.io.*;
public class B126 {
public static void main(String[] args) {
FastReader sc = new FastReader();
String s = sc.next();
int n = s.length();
if (n > 2) {
int[] pre = new int[n... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | 8af74a785f3f46b4b947701aa1e22f13 | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import ... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | 1ee613986b403dfd688c4dce92c6eee1 | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | 78e981d8a77d72dc57f171bdfbac1caf | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | /*
D A R K L _ _ O R D D A
K / | | \ L O R D
A R _ / | | \ _ K L O R
D A R K _ / | _ | \ _ L ... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | 2bbfd77a9ee2c95390230e104f02d36b | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | import java.util.*;
public class KMP {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.next();
int ans = kmp(s,s);
if (ans == -1 || s.length() < 3) {
System.out.println("Just a legend");
} else {
System... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | 9c26d6df8270fd7159b84d6f7d92d7cf | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;
public class l050 {
public static void main(String[] args) throws Exception {
// StringTokenizer stok = new StringTokenizer(new Scanner(new... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | 937a474e47246b6ba6342e07f843a663 | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | import java.io.File;
import java.util.HashSet;
import java.util.Scanner;
import java.util.StringTokenizer;
public class p009 {
public static void main(String args[]) throws Exception {
StringTokenizer stok = new StringTokenizer(new Scanner(System.in).useDelimiter("\\A").next());
StringBuilder sb = new StringBuild... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | 03384e34011b3af924fdfe04779bd2f8 | train_000.jsonl | 1320858000 | Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the tem... | 256 megabytes | import sun.reflect.generics.tree.Tree;
import java.io.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.*;
public class Newbie {
static InputReader sc = new InputReader(System.in);
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args... | Java | ["fixprefixsuffix", "abcdabc"] | 2 seconds | ["fix", "Just a legend"] | null | Java 8 | standard input | [
"dp",
"hashing",
"string suffix structures",
"binary search",
"strings"
] | fd94aea7ca077ee2806653d22d006fb1 | You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters. | 1,700 | Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes. | standard output | |
PASSED | a7d7e0175741f784bf75577ec90af753 | train_000.jsonl | 1591281300 | Johnny has just found the new, great tutorial: "How to become a grandmaster?". The tutorial tells many strange and unexpected for Johnny things, such as you have to be patient or that very important is solving many harder and harder problems. The boy has found an online judge with tasks divided by topics they cover. He... | 256 megabytes | //package round647;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Random;
public class B {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()... | Java | ["4\n5 2\n2 3 4 4 3\n3 1\n2 10 1000\n4 5\n0 1 1 100\n1 8\n89"] | 2 seconds | ["4\n1\n146981438\n747093407"] | NoteYou have to minimize the difference, not it's remainder. For example, if the minimum difference is equal to $$$2$$$, but there is also a distribution where the difference is $$$10^9 + 8$$$, then the answer is $$$2$$$, not $$$1$$$.In the first test case of the example, there're the following numbers: $$$4$$$, $$$8$$... | Java 11 | standard input | [
"implementation",
"sortings",
"greedy",
"math"
] | ff4fce15470e5dbd1153bd23b26896f1 | Input consists of multiple test cases. The first line contains one integer $$$t$$$ $$$(1 \leq t \leq 10^5)$$$Β β the number of test cases. Each test case is described as follows: The first line contains two integers $$$n$$$ and $$$p$$$ $$$(1 \leq n, p \leq 10^6)$$$. The second line contains $$$n$$$ integers $$$k_i$$$ $$... | 1,900 | Output one integerΒ β the reminder of division the answer by $$$1\,000\,000\,007$$$. | standard output | |
PASSED | 5c5dfe06a416b035d5e72dde00585140 | train_000.jsonl | 1591281300 | Johnny has just found the new, great tutorial: "How to become a grandmaster?". The tutorial tells many strange and unexpected for Johnny things, such as you have to be patient or that very important is solving many harder and harder problems. The boy has found an online judge with tasks divided by topics they cover. He... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.HashSet;
import java.io.Writer;
impo... | Java | ["4\n5 2\n2 3 4 4 3\n3 1\n2 10 1000\n4 5\n0 1 1 100\n1 8\n89"] | 2 seconds | ["4\n1\n146981438\n747093407"] | NoteYou have to minimize the difference, not it's remainder. For example, if the minimum difference is equal to $$$2$$$, but there is also a distribution where the difference is $$$10^9 + 8$$$, then the answer is $$$2$$$, not $$$1$$$.In the first test case of the example, there're the following numbers: $$$4$$$, $$$8$$... | Java 11 | standard input | [
"implementation",
"sortings",
"greedy",
"math"
] | ff4fce15470e5dbd1153bd23b26896f1 | Input consists of multiple test cases. The first line contains one integer $$$t$$$ $$$(1 \leq t \leq 10^5)$$$Β β the number of test cases. Each test case is described as follows: The first line contains two integers $$$n$$$ and $$$p$$$ $$$(1 \leq n, p \leq 10^6)$$$. The second line contains $$$n$$$ integers $$$k_i$$$ $$... | 1,900 | Output one integerΒ β the reminder of division the answer by $$$1\,000\,000\,007$$$. | standard output | |
PASSED | 8dc2d7b391df9d4ea4b803ed7d20f533 | train_000.jsonl | 1591281300 | Johnny has just found the new, great tutorial: "How to become a grandmaster?". The tutorial tells many strange and unexpected for Johnny things, such as you have to be patient or that very important is solving many harder and harder problems. The boy has found an online judge with tasks divided by topics they cover. He... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class TestClass {
static final class InputReader {
private final InputStream stream;
private final byte[] buf = new byte[1024];
private int curChar;
private int numChars;
public InputReader... | Java | ["4\n5 2\n2 3 4 4 3\n3 1\n2 10 1000\n4 5\n0 1 1 100\n1 8\n89"] | 2 seconds | ["4\n1\n146981438\n747093407"] | NoteYou have to minimize the difference, not it's remainder. For example, if the minimum difference is equal to $$$2$$$, but there is also a distribution where the difference is $$$10^9 + 8$$$, then the answer is $$$2$$$, not $$$1$$$.In the first test case of the example, there're the following numbers: $$$4$$$, $$$8$$... | Java 11 | standard input | [
"implementation",
"sortings",
"greedy",
"math"
] | ff4fce15470e5dbd1153bd23b26896f1 | Input consists of multiple test cases. The first line contains one integer $$$t$$$ $$$(1 \leq t \leq 10^5)$$$Β β the number of test cases. Each test case is described as follows: The first line contains two integers $$$n$$$ and $$$p$$$ $$$(1 \leq n, p \leq 10^6)$$$. The second line contains $$$n$$$ integers $$$k_i$$$ $$... | 1,900 | Output one integerΒ β the reminder of division the answer by $$$1\,000\,000\,007$$$. | standard output | |
PASSED | 3b4a1e113bbf7fa2cc341cd1756461cf | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
static BufferedReader br;
static StringTokenizer st;
static PrintWriter out;
public static Str... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 2db02a0585f509068ce95dc410ff2d2b | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class CopyOfD265_C {
public static void main(String[] args) throws IOEx... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 5e92a320f8e1b26e8f1338b0edc56ff0 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Dictionary;
... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 8eb41d66468c8d26d7ea49f3398f144e | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Program {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
static final int MOD = 1000000007;
static final double INF = 10000000000.0;
void solve() throws IOException {
int n, p;
n = nextI... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 5b874ec4c8d434e98a7dfc0905df23e4 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
while (cin.hasNext()) {
int n = cin.nextInt(), p = cin.nextInt();
String s = cin.next();
char[] ch = s.toCharArray();
int[] a = new int[1001];
for (int i = 0; i < n; i++... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 033b92f24c1a7f7d553c69c97bc44fc1 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class ProblemA {
public static void main(String[] args) throws Exception {
int n = nextInt()-1;
int p = nextInt();
String s = nextString();
char[] ch = s.toCharArray();
cha... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | c7136aff6fff90bd6021e2e583b52be1 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | public class A {
public A () {
int N = sc.nextInt();
int P = sc.nextInt();
char [] C = sc.nextChars();
if (!inc (C, N-1, P))
exit("NO");
while (test(C, P) == 0);
if (test(C, P) == 1)
print(new String(C));
else
print("NO");
}
int test(char [] C, int P) {
int N = C.length;
for (int i : re... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 44e11266eeb2f0a1ec78382db9f41d1b | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class CF265_Palindromes {
/**
* @param args
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int strLen = in.nextInt();
int nLetters = in.nextInt();
char[] initStr = in.next().toCharArray();
char[] res = null... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 36b0ac818484d54024a6a1b1380175e3 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF {
FastScanner in;
PrintWriter out;
void solve() {
int n = in.nextInt();
int p = in.nextInt();
char[] a = in.next().toCharArray();
for (int i = n - 1; i >= 0; i--) {
int now = 1 + a[i] - 'a';
while (now < p) {
boolean ok = true;
char nowC =... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | a861df7fb9933f1777009a20f9c3538d | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 61f8534952b9f8856dec082a6f312ad4 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;
/**
* Built using CHelper... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 5fa4a0ca7c1082d25a45fd9a4d79ecd6 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.StringTokenizer;
public class Solution {
public static void main(String[] args) {
new Solution().solve();
}
int n, p;
char a[];
String s;
char temp;
public void solve() {
r... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | f801d52139fb405ec0063bafcc12e52a | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
BufferedReader in;
StringTokenizer st;
PrintWriter out;
String next() throws IOException {
while (st == null || !st.hasMoreTokens())
st = new StringTokenizer(in.readLine());
return st.nextToken();
}
int nextInt() throws Exception {
return Integer... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 1ae0b9b4a114b073535dbf0928a48387 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class ProblemA {
boolean[] palin;
char[] cs;
private ProblemA() throws IOException {
BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
String... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 70824988fed99d4fbbf63c69e7ff2615 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.util.Scanner;
public class NotoPalindromes {
public static String check(String s, int n, int p) {
for (int i = 0; i < s.length(); i++) {
if (i >= 1 && s.charAt(i) == s.charAt(i - 1))
return null;
if (i >= 2 && s.charAt(i) == s.charAt(i - 2))
... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | e8ded4f891bfc983431589ffea227177 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class A {
static StringTokenizer st;
static BufferedReader br;
static PrintWr... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 792cd7284a01ea74f1da7833cc4b94b1 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.util.*;
import java.io.*;
public class A {
public static PrintStream out = System.out;
public static InputReader in = new InputReader(System.in);
public static void main(String args[]) {
int N, P;
N = in.nextInt();
P = in.nextInt();
String S = in.next();
c... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 37bf2287965be533e71e1ba05e7e2c89 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class A {
BufferedReader reader;
StringTokenizer tokenizer;
PrintWriter out;
public void solve() throws IOException {
int N = nextInt();
int... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | c9b80f640276ae57215b40a0d29cde5e | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = Sys... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 11438dcc04c4a6060b9c7fa4c4e50951 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class A {
void solve() throws IOException {
int n=nextInt();
int p=nextInt();
String s=nextToken();
int[] a=new int[n];
for(int i=0;i<n;i++)
a[i]=s.charAt(i)-'a';
boolean good=fal... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 81c92db31fe5793a3ce585a3c81c10fb | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
public class NoToPalindromes464A {
static void go() {
int n = in.nextInt();
int p = in.nextInt();
String str = in.nextString();
int[] s = new int[n + 3];
... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | 3364f62a07f4701c8c80bc242182a1cb | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | import java.util.*;
import java.io.*;
//question code:
public class A implements Runnable {
public void solve() throws IOException {
int N = nextInt(), K = nextInt();
char[] a = nextToken().toCharArray();
for(int i = N-1; i >= 0; i--){
for(char c ='a' ; c < 'a' +... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | f8130ebdbe2cd40a8735d40c999f5992 | train_000.jsonl | 1410103800 | Paul hates palindromes. He assumes that string s is tolerable if each its character is one of the first p letters of the English alphabet and s doesn't contain any palindrome contiguous substring of length 2 or more.Paul has found a tolerable string s of length n. Help him find the lexicographically next tolerable stri... | 256 megabytes | //AntiPalindrome.java
import java.util.*;
public class AntiPalindrome{
private static String resultString;
private static boolean foundResult;
private static boolean palindrome;
private static int N,P;
private static String aString;
private static int palindromeIndex;
private static final int BASENUM... | Java | ["3 3\ncba", "3 4\ncba", "4 4\nabcd"] | 1 second | ["NO", "cbd", "abda"] | NoteString s is lexicographically larger (or simply larger) than string t with the same length, if there is number i, such that s1β=βt1, ..., siβ=βti, siβ+β1β>βtiβ+β1.The lexicographically next tolerable string is the lexicographically minimum tolerable string which is larger than the given one.A palindrome is a str... | Java 7 | standard input | [
"greedy",
"strings"
] | 788ae500235ca7b7a7cd320f745d1070 | The first line contains two space-separated integers: n and p (1ββ€βnββ€β1000; 1ββ€βpββ€β26). The second line contains string s, consisting of n small English letters. It is guaranteed that the string is tolerable (according to the above definition). | 1,700 | If the lexicographically next tolerable string of the same length exists, print it. Otherwise, print "NO" (without the quotes). | standard output | |
PASSED | ec44c9e26481ba76a5cfed39006f342f | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.Stream;
import java.util.Map;
import java.util.Collection;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Optional;
import java.util.HashMap;
/**
* Built usi... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | b1ccf9203ab960e56259ca5a050bc862 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.*;
public class Watchmen {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
Map<Long, Integer> X = new HashMap<>();
Map<Long, Integer> Y = new HashMap<>();
Map<Map<Long,Long>,Integer> XY = new HashMap<>();
int n... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 6ec247606f390aa04bb47b0f5f4c47d2 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.*;
public class Watchmen1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
Map<Long, Integer> X = new HashMap<>();
Map<Long, Integer> Y = new HashMap<>();
Map<Map<Long,Long>,Integer> XY = new HashMap<>();
int ... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | f8d7fd60bf34412a1cce0cf2d0aba396 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Watchmen {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in=new Scanner(System.in);
int num=in.nextInt();
Map<Long,Integer> X=new HashMap<>();
Map<Long,Integer> Y=new HashMap<>();
... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 0f6d62b4179da3f4fbcb121b25235bb9 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import javafx.util.Pair;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Reader in = new Reader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
int n = in.nextI... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 080e330e8655a58a567d54c49bea28a2 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.awt.Point;
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Watchmen {
static class Solver {
MyReader mr = new MyReader();
public void solve() {
int n = mr.nextInt();
Map<Integer,Integer> xm = new HashMap<>();
Map<Integ... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | be7edad50fb9351a0a19bf557a9e4f9d | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes |
import java.awt.*;
import java.util.*;
/**
* Created by maxim on 3/12/16.
*/
public class C651 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long res = 0;
HashMap<Integer, Integer> xCoords = new HashMap<>();
HashMap<... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 63341deb109ef7afdbd22826bae87575 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.awt.Point;
import java.util.HashMap;
import java.util.Scanner;
public class c651 {
public static void main(String[] args) {
// TODO Auto-generated method stub
HashMap<Integer, Integer> xs = new HashMap<Integer,Integer>();
HashMap<Integer,Integer> ys = new HashMap<Integer,Integer>();
HashMap<Point... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | c76a30d7978610e5aed7979d8705c590 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Watchmen {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in=new Scanner(System.in);
int num=in.nextInt();
Map<Long,Integer> X=new HashMap<>();
Map<Long,Integer> Y=new HashMap<>();
... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 69b762a66e99314a5980963ffe96db52 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
public class ProblemC {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();// n~2e5
Set<Point> p = new HashSet<>();
Map<Point, Integer> dup =... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 180cddff2b166fa70f5704ce27c5e1e8 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.*;
public class main {
public static void main(String agrs[]) {
Scanner in = new Scanner (System.in);
int numofwatchmen=in.nextInt();
long output=0;
Map<String,Integer> xy=new HashMap<>();
Map<Integer ,Integer>x=new HashMap<>();
Map<Integer ,Integer>y=new HashMap<>();
for (int i=0;i<numofw... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 40ceea3b13c8a227c53c742b17c70cfb | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | /*
* import java.util.*; public class Manhattan_euclid {
*/
/*// public static void main(String[] args) {
// // TODO Auto-generated method stub
// Scanner sc=new Scanner(System.in);
// int n=sc.nextInt();
// Pair1 arr[]=new Pair1[n];
// HashMap<Long,Integer> h1=new HashMap<>();
// HashMap<Long,Integer> h2=new H... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 2f692bd83e6bc26b51b7a39f065d1319 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | /*
* import java.util.*; public class Manhattan_euclid {
*/
/*// public static void main(String[] args) {
// // TODO Auto-generated method stub
// Scanner sc=new Scanner(System.in);
// int n=sc.nextInt();
// Pair1 arr[]=new Pair1[n];
// HashMap<Long,Integer> h1=new HashMap<>();
// HashMap<Long,Integer> h2=new H... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | e62c59caec44ff5bc682e8e60415f780 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import javafx.util.Pair;
import java.util.HashMap;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner s = new Scanner(System.in);
int n = s.nextInt();
long answer=0;
HashMap<Integer, Integer> x = new HashMap<>();
HashMap<Integer, In... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | dc6d2d6721750916489a5ef63277091c | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private static final boolean FILE_IO = false;
static StringTokenizer st;
static BufferedReader in;
static PrintWriter out;
static int nextInt() throws IOException {
return Integer.parseInt(nextToken());
}
static long nextL... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 8c8796044bcf8e026466380952ceba6f | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | //package CF;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class A {
... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | b5391afa302cc5cb5d13e3eb1c0d0708 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Set;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.util.Map;
imp... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | c1038e4732c8af8da61e82b1ab95b5d0 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Set;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.util.Map;
imp... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | bbe61e59f26ee489fef97ed5109a7da0 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class Watchmen {
static final int N = (int) 2e9 + 7;
void solve() {
... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 92e88ff551576fde49e4e3528ecd2169 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.*;
public class Problem_03 {
public static void main(String[] args) throws Exception {
BufferedReader input = new BufferedReader(new InputStreamReader(System... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 236fb3c87ac00368387cc00df065c39d | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.*;
public class C {
public static void main(String[] args) {
new C().run();
}
Scanner in;
public void run() {
try {
in = new Scanner(System.in);
solve();
} catch (Exception e) {
}
}
class Pair {
int x, y;
... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 88a187b85d9339ede02f72175c3495f8 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes |
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long counter = 0;
Map<Long, Integer> xMap = new HashMap<>();
Map<Lon... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | b7544b5cb5cc9fee7d7a43d733a9bc05 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes |
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
public class main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long counter = 0;
... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | cebac2854cc9a8f0ee03afa443165796 | train_000.jsonl | 1457342700 | Watchmen are in a danger and Doctor Manhattan together with his friend Daniel Dreiberg should warn them as soon as possible. There are n watchmen on a plane, the i-th watchman is located at point (xi,βyi).They need to arrange a plan, but there are some difficulties on their way. As you know, Doctor Manhattan considers ... | 256 megabytes | import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
public class main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long counter = 0;
Map<Long, Integer> xMap = new Has... | Java | ["3\n1 1\n7 5\n1 5", "6\n0 0\n0 1\n0 2\n-1 1\n0 1\n1 1"] | 3 seconds | ["2", "11"] | NoteIn the first sample, the distance between watchman 1 and watchman 2 is equal to |1β-β7|β+β|1β-β5|β=β10 for Doctor Manhattan and for Daniel. For pairs (1,β1), (1,β5) and (7,β5), (1,β5) Doctor Manhattan and Daniel will calculate the same distances. | Java 8 | standard input | [
"data structures",
"geometry",
"implementation",
"sortings"
] | bd7b85c0204f6b36dc07f8a96fc36161 | The first line of the input contains the single integer n (1ββ€βnββ€β200β000)Β β the number of watchmen. Each of the following n lines contains two integers xi and yi (|xi|,β|yi|ββ€β109). Some positions may coincide. | 1,400 | Print the number of pairs of watchmen such that the distance between them calculated by Doctor Manhattan is equal to the distance calculated by Daniel. | standard output | |
PASSED | 7416a75ba97e4010e0a242821df8d487 | train_000.jsonl | 1389540600 | Sereja has a bracket sequence s1,βs2,β...,βsn, or, in other words, a string s of length n, consisting of characters "(" and ")".Sereja needs to answer m queries, each of them is described by two integers li,βri (1ββ€βliββ€βriββ€βn). The answer to the i-th query is the length of the maximum correct bracket subsequence of s... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Stack;
import java.util.StringTokenizer;
public class Main {
static class Reader
{
BufferedReader r;
... | Java | ["())(())(())(\n7\n1 1\n2 3\n1 2\n1 12\n8 12\n5 11\n2 10"] | 1 second | ["0\n0\n2\n10\n4\n6\n6"] | NoteA subsequence of length |x| of string sβ=βs1s2... s|s| (where |s| is the length of string s) is string xβ=βsk1sk2... sk|x| (1ββ€βk1β<βk2β<β...β<βk|x|ββ€β|s|).A correct bracket sequence is a bracket sequence that can be transformed into a correct aryphmetic expression by inserting characters "1" and "+" betwe... | Java 7 | standard input | [
"data structures"
] | a3e88504793c44fb3110a322d9dbdf17 | The first line contains a sequence of characters s1,βs2,β...,βsn (1ββ€βnββ€β106) without any spaces. Each character is either a "(" or a ")". The second line contains integer m (1ββ€βmββ€β105) β the number of queries. Each of the next m lines contains a pair of integers. The i-th line contains integers li,βri (1ββ€βliββ€βriβ... | 2,000 | Print the answer to each question on a single line. Print the answers in the order they go in the input. | standard output | |
PASSED | ca618e6945945eaef17483027b9bc29a | train_000.jsonl | 1543934100 | You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0. | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class B {
public static void main(String[] args) {
FastReader in = new FastReader();
TreeSet<Integer> list = new TreeSet<>();
... | Java | ["3 5\n1 2 3", "4 2\n10 3 5 3"] | 1 second | ["1\n1\n1\n0\n0", "3\n2"] | NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ... | Java 8 | standard input | [
"implementation",
"sortings"
] | 0f100199a720b0fdead5f03e1882f2f3 | The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array. | 1,000 | Print the minimum non-zero element before each operation in a new line. | standard output | |
PASSED | a64cf6133f0ff9de48ae514934100552 | train_000.jsonl | 1543934100 | You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0. | 256 megabytes | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.TreeSet;
public class B {
public static void main(String[] args) throws IOException {
Reader in = new Reader();
TreeSet<Integer> list = new TreeSet<>();
int n = in.nextInt(),... | Java | ["3 5\n1 2 3", "4 2\n10 3 5 3"] | 1 second | ["1\n1\n1\n0\n0", "3\n2"] | NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ... | Java 8 | standard input | [
"implementation",
"sortings"
] | 0f100199a720b0fdead5f03e1882f2f3 | The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array. | 1,000 | Print the minimum non-zero element before each operation in a new line. | standard output | |
PASSED | 586bf5e60ed770019f78407404f17ff4 | train_000.jsonl | 1543934100 | You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0. | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.InputMismatchException;
public class subtraction
{
void solve()throws IOException
{
/**************** write your code here ***********************/
int n=ni(),k=ni();int s=0,c=0,r=0,id=0;
... | Java | ["3 5\n1 2 3", "4 2\n10 3 5 3"] | 1 second | ["1\n1\n1\n0\n0", "3\n2"] | NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ... | Java 8 | standard input | [
"implementation",
"sortings"
] | 0f100199a720b0fdead5f03e1882f2f3 | The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array. | 1,000 | Print the minimum non-zero element before each operation in a new line. | standard output | |
PASSED | a1c417845d2c7865b2cf1fc0054e0408 | train_000.jsonl | 1543934100 | You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0. | 256 megabytes | import java.io.*;
import java.util.*;
public class yay {
public static int mod(int a, int b){
return (a%b + b)%b;
}
public static long gcd(long a, long b)
{
if(b == 0) return a;
return gcd(b, a%b);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
PrintWriter out = new Pri... | Java | ["3 5\n1 2 3", "4 2\n10 3 5 3"] | 1 second | ["1\n1\n1\n0\n0", "3\n2"] | NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ... | Java 8 | standard input | [
"implementation",
"sortings"
] | 0f100199a720b0fdead5f03e1882f2f3 | The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array. | 1,000 | Print the minimum non-zero element before each operation in a new line. | standard output | |
PASSED | b98b5c83eb5b7391867f477e6375e7ea | train_000.jsonl | 1543934100 | You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0. | 256 megabytes | import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class B
{
public static void main(String [ ] args)
{
int n, k;
int[] list = new int[100001];
Scanner inn = new Scanner(System.in);
... | Java | ["3 5\n1 2 3", "4 2\n10 3 5 3"] | 1 second | ["1\n1\n1\n0\n0", "3\n2"] | NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ... | Java 8 | standard input | [
"implementation",
"sortings"
] | 0f100199a720b0fdead5f03e1882f2f3 | The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array. | 1,000 | Print the minimum non-zero element before each operation in a new line. | standard output | |
PASSED | edadd7c0a897ef9cdd087abfa5e8daae | train_000.jsonl | 1543934100 | You're given an array $$$a$$$. You should repeat the following operation $$$k$$$ times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the array. If all the elements are 0s, just print 0. | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
static int i,j,k,l,temp,count;
public static void main(String[] args) throws IOException{
/*
.
.
.
.
.
.
*/
int n=ni();
int k=ni();
int arr[]=nia(n);
Arrays.sort(arr);
i=0;
temp=0;
while(k>0 && i<n){
arr[i] -= temp;
temp += a... | Java | ["3 5\n1 2 3", "4 2\n10 3 5 3"] | 1 second | ["1\n1\n1\n0\n0", "3\n2"] | NoteIn the first sample:In the first step: the array is $$$[1,2,3]$$$, so the minimum non-zero element is 1.In the second step: the array is $$$[0,1,2]$$$, so the minimum non-zero element is 1.In the third step: the array is $$$[0,0,1]$$$, so the minimum non-zero element is 1.In the fourth and fifth step: the array is ... | Java 8 | standard input | [
"implementation",
"sortings"
] | 0f100199a720b0fdead5f03e1882f2f3 | The first line contains integers $$$n$$$ and $$$k$$$ $$$(1 \le n,k \le 10^5)$$$, the length of the array and the number of operations you should perform. The second line contains $$$n$$$ space-separated integers $$$a_1, a_2, \ldots, a_n$$$ $$$(1 \le a_i \le 10^9)$$$, the elements of the array. | 1,000 | Print the minimum non-zero element before each operation in a new line. | standard output | |
PASSED | cf25a037732c2dfca52b68957d316054 | train_000.jsonl | 1576386300 | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int T = scan.nextInt();
for (int o=0;o<T;o++){
String ss = scan.next();
String cc = scan.next();
String[] s = ss.split("");
St... | Java | ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA"] | 2 seconds | ["AMAZON\n---\nAPPLE"] | NoteIn the first test case, it is possible to swap the second and the fourth letters of the string and the resulting string "AMAZON" is lexicographically smaller than "APPLE".It is impossible to improve the product's name in the second test case and satisfy all conditions.In the third test case, it is possible not to s... | Java 11 | standard input | [
"greedy"
] | 88743b7acb4a95dc0d5bb2e073714c49 | The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 1500$$$) denoting the number of test cases. The next lines contain descriptions of the test cases. Each test case consists of a single line containing two space-separated strings $$$s$$$ and $$$c$$$ ($$$2 \le |s| \le 5000, 1 \le |c| \le 5000$$$).... | 1,600 | For each test case, output a single line containing a single string, which is either the new name which is obtained after swapping no more than one pair of characters that is strictly lexicographically smaller than $$$c$$$. In case there are many possible such strings, you can output any of them; three dashes (the s... | standard output | |
PASSED | 81d239a5aad547445f8d88890746766d | train_000.jsonl | 1576386300 | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | 256 megabytes | //package contest1281;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class B {
private final FastReader fastReader = new FastReader();
private void swap(char[] chars, int i, int j) {
char ... | Java | ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA"] | 2 seconds | ["AMAZON\n---\nAPPLE"] | NoteIn the first test case, it is possible to swap the second and the fourth letters of the string and the resulting string "AMAZON" is lexicographically smaller than "APPLE".It is impossible to improve the product's name in the second test case and satisfy all conditions.In the third test case, it is possible not to s... | Java 11 | standard input | [
"greedy"
] | 88743b7acb4a95dc0d5bb2e073714c49 | The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 1500$$$) denoting the number of test cases. The next lines contain descriptions of the test cases. Each test case consists of a single line containing two space-separated strings $$$s$$$ and $$$c$$$ ($$$2 \le |s| \le 5000, 1 \le |c| \le 5000$$$).... | 1,600 | For each test case, output a single line containing a single string, which is either the new name which is obtained after swapping no more than one pair of characters that is strictly lexicographically smaller than $$$c$$$. In case there are many possible such strings, you can output any of them; three dashes (the s... | standard output | |
PASSED | 4dbd32654c3ad3accd5ba015b0afaa1e | train_000.jsonl | 1576386300 | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static point a[];
static int check(int wx, int wy, int sx, int sy) { //waurma
int cnt = 0;
for (int i = 0; i < a.length; i++) {
int x = a[i].x;
int y = a[i].y;
if (wx >= Math.min(sx, x) && wy >= Math... | Java | ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA"] | 2 seconds | ["AMAZON\n---\nAPPLE"] | NoteIn the first test case, it is possible to swap the second and the fourth letters of the string and the resulting string "AMAZON" is lexicographically smaller than "APPLE".It is impossible to improve the product's name in the second test case and satisfy all conditions.In the third test case, it is possible not to s... | Java 11 | standard input | [
"greedy"
] | 88743b7acb4a95dc0d5bb2e073714c49 | The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 1500$$$) denoting the number of test cases. The next lines contain descriptions of the test cases. Each test case consists of a single line containing two space-separated strings $$$s$$$ and $$$c$$$ ($$$2 \le |s| \le 5000, 1 \le |c| \le 5000$$$).... | 1,600 | For each test case, output a single line containing a single string, which is either the new name which is obtained after swapping no more than one pair of characters that is strictly lexicographically smaller than $$$c$$$. In case there are many possible such strings, you can output any of them; three dashes (the s... | standard output | |
PASSED | 857bc01c58e4d17ab27b89520fb54e03 | train_000.jsonl | 1576386300 | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.util.stream.*;
import java.util.function.*;
import java.util.function.Predicate;
import java.math.BigInteger;
import java.sql.Array;
import java.time.Instant;
import java.time.Duration;
import java.util.concurrent.*;
public class Main {
... | Java | ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA"] | 2 seconds | ["AMAZON\n---\nAPPLE"] | NoteIn the first test case, it is possible to swap the second and the fourth letters of the string and the resulting string "AMAZON" is lexicographically smaller than "APPLE".It is impossible to improve the product's name in the second test case and satisfy all conditions.In the third test case, it is possible not to s... | Java 11 | standard input | [
"greedy"
] | 88743b7acb4a95dc0d5bb2e073714c49 | The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 1500$$$) denoting the number of test cases. The next lines contain descriptions of the test cases. Each test case consists of a single line containing two space-separated strings $$$s$$$ and $$$c$$$ ($$$2 \le |s| \le 5000, 1 \le |c| \le 5000$$$).... | 1,600 | For each test case, output a single line containing a single string, which is either the new name which is obtained after swapping no more than one pair of characters that is strictly lexicographically smaller than $$$c$$$. In case there are many possible such strings, you can output any of them; three dashes (the s... | standard output | |
PASSED | d070535ad5b42d8880e909d9b3e03b6c | train_000.jsonl | 1576386300 | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | 256 megabytes | import java.util.*;
import java.io.*;
public class File {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int test = 0; test < t; test++) {
char[] a = sc.next().toCharArray();
char[] b = sc.next().to... | Java | ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA"] | 2 seconds | ["AMAZON\n---\nAPPLE"] | NoteIn the first test case, it is possible to swap the second and the fourth letters of the string and the resulting string "AMAZON" is lexicographically smaller than "APPLE".It is impossible to improve the product's name in the second test case and satisfy all conditions.In the third test case, it is possible not to s... | Java 11 | standard input | [
"greedy"
] | 88743b7acb4a95dc0d5bb2e073714c49 | The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 1500$$$) denoting the number of test cases. The next lines contain descriptions of the test cases. Each test case consists of a single line containing two space-separated strings $$$s$$$ and $$$c$$$ ($$$2 \le |s| \le 5000, 1 \le |c| \le 5000$$$).... | 1,600 | For each test case, output a single line containing a single string, which is either the new name which is obtained after swapping no more than one pair of characters that is strictly lexicographically smaller than $$$c$$$. In case there are many possible such strings, you can output any of them; three dashes (the s... | standard output | |
PASSED | 7638121333b843cdf7b7a82a06028692 | train_000.jsonl | 1576386300 | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static class PairComparator implements Comparator<Pair> {
@Override
public int compare(Pair x, Pair y) {
if (x.val < y.val)return -1;
if (x.val > y.val)return 1;
if (x.val == y.val){
if (x.ind < y.ind)return -1;
if (x.ind > y.ind)return 1;... | Java | ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA"] | 2 seconds | ["AMAZON\n---\nAPPLE"] | NoteIn the first test case, it is possible to swap the second and the fourth letters of the string and the resulting string "AMAZON" is lexicographically smaller than "APPLE".It is impossible to improve the product's name in the second test case and satisfy all conditions.In the third test case, it is possible not to s... | Java 11 | standard input | [
"greedy"
] | 88743b7acb4a95dc0d5bb2e073714c49 | The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 1500$$$) denoting the number of test cases. The next lines contain descriptions of the test cases. Each test case consists of a single line containing two space-separated strings $$$s$$$ and $$$c$$$ ($$$2 \le |s| \le 5000, 1 \le |c| \le 5000$$$).... | 1,600 | For each test case, output a single line containing a single string, which is either the new name which is obtained after swapping no more than one pair of characters that is strictly lexicographically smaller than $$$c$$$. In case there are many possible such strings, you can output any of them; three dashes (the s... | standard output | |
PASSED | 25d9a71710199044daa4a1cfa49eddc2 | train_000.jsonl | 1576386300 | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | 256 megabytes |
import java.io.PrintWriter;
import java.util.Scanner;
public class Azamon {
static PrintWriter out;
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
out = new PrintWriter(System.out);
int t = sc.nextInt();
for (int i = 0; i < t; i... | Java | ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA"] | 2 seconds | ["AMAZON\n---\nAPPLE"] | NoteIn the first test case, it is possible to swap the second and the fourth letters of the string and the resulting string "AMAZON" is lexicographically smaller than "APPLE".It is impossible to improve the product's name in the second test case and satisfy all conditions.In the third test case, it is possible not to s... | Java 11 | standard input | [
"greedy"
] | 88743b7acb4a95dc0d5bb2e073714c49 | The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 1500$$$) denoting the number of test cases. The next lines contain descriptions of the test cases. Each test case consists of a single line containing two space-separated strings $$$s$$$ and $$$c$$$ ($$$2 \le |s| \le 5000, 1 \le |c| \le 5000$$$).... | 1,600 | For each test case, output a single line containing a single string, which is either the new name which is obtained after swapping no more than one pair of characters that is strictly lexicographically smaller than $$$c$$$. In case there are many possible such strings, you can output any of them; three dashes (the s... | standard output | |
PASSED | 080a0031b3a60803caba0fca88bb4395 | train_000.jsonl | 1576386300 | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(Strin... | Java | ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA"] | 2 seconds | ["AMAZON\n---\nAPPLE"] | NoteIn the first test case, it is possible to swap the second and the fourth letters of the string and the resulting string "AMAZON" is lexicographically smaller than "APPLE".It is impossible to improve the product's name in the second test case and satisfy all conditions.In the third test case, it is possible not to s... | Java 11 | standard input | [
"greedy"
] | 88743b7acb4a95dc0d5bb2e073714c49 | The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 1500$$$) denoting the number of test cases. The next lines contain descriptions of the test cases. Each test case consists of a single line containing two space-separated strings $$$s$$$ and $$$c$$$ ($$$2 \le |s| \le 5000, 1 \le |c| \le 5000$$$).... | 1,600 | For each test case, output a single line containing a single string, which is either the new name which is obtained after swapping no more than one pair of characters that is strictly lexicographically smaller than $$$c$$$. In case there are many possible such strings, you can output any of them; three dashes (the s... | standard output | |
PASSED | 42e3b3b993c4870645984046ea2616ed | train_000.jsonl | 1576386300 | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | 256 megabytes | import java.io.*;
import java.util.*;
public class d2prac implements Runnable
{
private boolean console=false;
public void solve(int t)
{
int i;
char s[]=in.ns().toCharArray(); int n=s.length;
char s1[]=in.ns().toCharArray();
for(i=0;i<n-1;i++)
{
char min=s[i]; int ind=-1;
for(int j=n-1;j>=i+... | Java | ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA"] | 2 seconds | ["AMAZON\n---\nAPPLE"] | NoteIn the first test case, it is possible to swap the second and the fourth letters of the string and the resulting string "AMAZON" is lexicographically smaller than "APPLE".It is impossible to improve the product's name in the second test case and satisfy all conditions.In the third test case, it is possible not to s... | Java 11 | standard input | [
"greedy"
] | 88743b7acb4a95dc0d5bb2e073714c49 | The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 1500$$$) denoting the number of test cases. The next lines contain descriptions of the test cases. Each test case consists of a single line containing two space-separated strings $$$s$$$ and $$$c$$$ ($$$2 \le |s| \le 5000, 1 \le |c| \le 5000$$$).... | 1,600 | For each test case, output a single line containing a single string, which is either the new name which is obtained after swapping no more than one pair of characters that is strictly lexicographically smaller than $$$c$$$. In case there are many possible such strings, you can output any of them; three dashes (the s... | standard output | |
PASSED | aa0af7e9d0613524a35910c481b59a31 | train_000.jsonl | 1576386300 | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | 256 megabytes | import java.io.*;
import java.util.*;
public class B607{
public static void main(String[] args) throws Exception {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
String st=sc.next();
String st2=sc.next();
if(st.compareTo(st2)<0){
System.out.println(st);... | Java | ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA"] | 2 seconds | ["AMAZON\n---\nAPPLE"] | NoteIn the first test case, it is possible to swap the second and the fourth letters of the string and the resulting string "AMAZON" is lexicographically smaller than "APPLE".It is impossible to improve the product's name in the second test case and satisfy all conditions.In the third test case, it is possible not to s... | Java 11 | standard input | [
"greedy"
] | 88743b7acb4a95dc0d5bb2e073714c49 | The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 1500$$$) denoting the number of test cases. The next lines contain descriptions of the test cases. Each test case consists of a single line containing two space-separated strings $$$s$$$ and $$$c$$$ ($$$2 \le |s| \le 5000, 1 \le |c| \le 5000$$$).... | 1,600 | For each test case, output a single line containing a single string, which is either the new name which is obtained after swapping no more than one pair of characters that is strictly lexicographically smaller than $$$c$$$. In case there are many possible such strings, you can output any of them; three dashes (the s... | standard output | |
PASSED | f7dc0e2b7746473da231bdb3501f9ec2 | train_000.jsonl | 1576386300 | Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem, you think, is that he's not ranking high enough on the search engines. If only he could rename his products to have better ... | 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 | ["3\nAZAMON APPLE\nAZAMON AAAAAAAAAAALIBABA\nAPPLE BANANA"] | 2 seconds | ["AMAZON\n---\nAPPLE"] | NoteIn the first test case, it is possible to swap the second and the fourth letters of the string and the resulting string "AMAZON" is lexicographically smaller than "APPLE".It is impossible to improve the product's name in the second test case and satisfy all conditions.In the third test case, it is possible not to s... | Java 11 | standard input | [
"greedy"
] | 88743b7acb4a95dc0d5bb2e073714c49 | The first line of input contains a single integer $$$t$$$ ($$$1 \le t \le 1500$$$) denoting the number of test cases. The next lines contain descriptions of the test cases. Each test case consists of a single line containing two space-separated strings $$$s$$$ and $$$c$$$ ($$$2 \le |s| \le 5000, 1 \le |c| \le 5000$$$).... | 1,600 | For each test case, output a single line containing a single string, which is either the new name which is obtained after swapping no more than one pair of characters that is strictly lexicographically smaller than $$$c$$$. In case there are many possible such strings, you can output any of them; three dashes (the s... | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.