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 | f157eabcb2e0cd02d56c277cc98ff158 | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
public class Solution
{
public static class pair implements Comparable<pair>
{
int f0,f1;
pair(int a0,int a1)
{
f0 = a0;
f1 = a1;
}
public int ... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | 52ff90ed94741a06ff4296a03ef160d7 | train_001.jsonl | 1561559700 | This problem is a version of problem D from the same contest with some additional constraints and tasks.There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 \le a_i \le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of c... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.AbstractSet;
import java.util.InputMismatchException;
import java.util.Random;
import java.util.Map;
import java.io.OutputStreamWriter;
import java.util.NoSuchEl... | Java | ["3\n8\n1 0\n4 1\n2 0\n4 1\n5 1\n6 1\n3 0\n2 0\n4\n1 1\n1 1\n2 1\n2 1\n9\n2 0\n2 0\n4 1\n4 1\n4 1\n7 0\n7 1\n7 0\n7 1"] | 2 seconds | ["3 3\n3 3\n9 5"] | NoteIn the first query, you can include two candies of type $$$4$$$ and one candy of type $$$5$$$. All of them have $$$f_i = 1$$$ and you don't mind giving them away as part of the gift. | Java 8 | standard input | [
"implementation",
"sortings",
"greedy"
] | bcde53a1671a66eb16a37139380f4ae5 | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 2 \cdot 10^5$$$) — the number of queries. The first line of each query contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. Then $$$n$$$ lines follow, each containing two integers $$$a_i$$$ and $$$f_i$$$ ($$$1 \le... | 2,000 | For each query print two integers: the maximum number of candies in a gift you can compose, according to the constraints in the statement; the maximum number of candies having $$$f_i = 1$$$ in a gift you can compose that contains the maximum possible number of candies. | standard output | |
PASSED | e8cdcd33e2036047b7cdef7fb0376f9a | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 18ae16ab9888f46d52216d5c599841b1 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
public class LexMaxSubSeq {
private static int binarySearch(char[] maxSubSeq, int start, int end, char key){
int low = start, high = end;
while(low<=high){
int mid = (low+high)/2;
... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 14c7f2b700ab7807ae566e8dad42a556 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void solution(BufferedReader reader, PrintWriter writer)
throws IOException {
In in = new In(reader);
Out out = new Out(writer);
char[] s = in.next().toCharArray();
int n = s.length;
char[] max ... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 1de78593ec62f1be5a3cbe541b10a6fc | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | /**
* Created by Karan Jobanputra on 29-05-2017.
*/
import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main {
public static void main(String args[]) throws Exception {
InputReader sc = new InputReader(Sys... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 8334ead995706d79e93987500bf5ce3d | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | /**
* Created by Karan Jobanputra on 29-05-2017.
*/
import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Main {
public static void main(String args[]) throws Exception {
InputReader sc = new InputReader(Sys... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 83c47fe9a30d502ae9a64af84d20a8a0 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;
import... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | e5691101568b9223d2aa0a04df700f04 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;
import... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 39e0e438dbf0b68b00cb988cdbb82aa8 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scan... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 80800818c31b2a317b15ed1cbbc7d4a4 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class SolutionA{
public static void main(String[] args){
new SolutionA().run();
}
void solve(){
char c[] = in.next().toCharArray();
int n = c.length;
int pos = 0;
StringBuilder sb = new StringBuilder();
for(char t='z'; t>='a'; t--){
fo... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | b82c7758239a5e5908ca51e41e958fe0 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class CF196A {
public static void main(String []args) {
MyScanner in = new MyScanner();
out = new PrintWrit... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | ea9792fbe5040ab9123d2157d04daa25 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
char[] x = sc.next().toCharArray();
int n = x.length;
int... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 8c623bcdb80bd25b7ebc21c3dd16912d | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import java.lang.*;
import java.math.*;
import java.text.*;
import java.io.*;
public final class Solution {
static PrintWriter out = new PrintWriter(System.out);
static void flush() {
out.flush();
}
static class FastReader {
BufferedReader br;
Str... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 50bbaf98c119c78baddd1748f9482f19 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
public class C {
static class Pair implements Comparable<Pair> {
int idx;
c... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 2a5344434071401d9925ab6057499e0b | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Practice {
public static void main(String args[]) throws IOException {
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
Strin... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 54f0c243d9770a799cc9c51c9fb23730 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Stack;
import java.util.StringTokenizer;
public class Code {
public static void main(String[] args) {
// Use the Scanner class
... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 1af6446c62763e6d8f6ff101e5fd8161 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class Main extends PrintWriter {
BufferedReader in;
StringTokenizer stok;
final Random rand = new Random(31);
final int inf = (int) 1e9;
final long linf = (long) 1e18;
final static String IO = "_std";
void solve... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | d84e8542444c272a16e5166da9574c58 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
FastReader scn;
PrintWriter out;
String INPUT = "";
void solve() {
char[] arr = scn.next().toCharArray();
int n = arr.length;
int[] fr = new int[26];
for(char ch : arr) {
fr[ch - 'a']++;
}
int[][] pos = new int[26][];
for(int i = 0; i < 26... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 7ce3ff3cc66af77063c117213263eff0 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.FileReader;
import java.io.FileWriter;
//import java.lang.StringBuilder;
import java.util.StringTokenizer;
//import java.lang.Comparable;
//import java.... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 4a4c31297efe93664a9c924537899c83 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.Iterator;
import java.util.LinkedList;
import j... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | aee809fee74ff50f9104121408986e57 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | def671eb037a710b185b0612764ef268 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;
public class A196{
public static void main(String... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | a8b089f57318202230e739f4fdaada75 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 85cca28cf6cc2483920d64c4cc5eedf0 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.util.*;
import static java.lang.Math.*;
import java.io.*;
public class SolutionB {
public static void main(String args[])throws IOException{
Scanner sc = new Scanner(System.in);
String s = sc.next();
int N = s.length();
Stack<Character> ... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | d46f89ac56ff8b78d8c2185c5a578a43 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.util.*;
import static java.lang.Math.*;
import java.io.*;
public class SolutionB {
public static void main(String args[])throws IOException{
Scanner sc = new Scanner(System.in);
String s = sc.next();
int N = s.length();
List<Integer> d[]... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | d7cab854d56ab4fee28d8c89de1f8138 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
MyScanner sc = ... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | fb713d224760ff347304b058994d4590 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.function.Consumer;
public class LMS {
public static void main(String[] args) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in))) {
cha... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | e56942246a60b7c014690bee0742980c | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class CF124A {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner (System.in);
String s=sc.next();
StringBuilder out=... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 40f1fc1a8cf2e1d3a2f56d256cb6ee59 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class LMS
{
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buf... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 29b2b85fa3eaf663a4af046bb2466097 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.*;
public class cf5
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
String str=s.next();
StringBuffer sb=new StringBuffer();
int max=0;
for(int i=str.length()-1;i>=0;i--)
{
char ch=str.charAt(i);
if((int)ch>=max)
{
m... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 858ba47a02b2d41feb1be4dc0696ae89 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Div1A {
public static void main(String[] args) throws IOException {
new Div1A().run();
}
FastScanner in;
PrintWriter out;
void run() throws IOException {
in = new FastScanner(System.in);
out = new PrintWriter(System.out, true);
solve();
out.close();
... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | c2aaff38673e35f3b39e60f349694f7b | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class LexicographicallyMaximumSubsequence {
public static void main(String[] args) {
PrintWriter pw = new PrintWriter(System.o... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 5dc4a1784c31b41539ca3504d9eefcdf | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.*;
public final class code
// class code
// public class Solution
{
static void solve()throws IOException
{
String s=nextLine();
int n=s.length();
s=" "+s;
Stack<Character> stack=new Stack<>();
stack.push(s.charAt(n));
int curr=s.charAt(n);
for(int i=n-1;i>=1;i--)
{
... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | b388d6724720fb5d256a40d9521aade6 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class C {
public static void main(String[] args) throws Exception{... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 7a4c58076d97410c138810989850bf4d | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class templ {
public static void main(String[] args) throws FileNotFoundException {
try
{
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
int i,j,last=-1;
... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | b53df8984be5afabd305d976338dae18 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;
/**
*... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 8c469b09a24ee97a28aadd9dbac2b83f | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.*;
public class lexi {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
int length = s.length();
char max = s.charAt(length-1);
Deque<Character> deque = new ArrayD... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | e14bf63adc60b802a8f0cb6db72b403f | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main
{
static final int INF = Integer.MAX_VALUE;
static int mergeSort(int[] a,int [] c, int begin, int end)
{
int ... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 3595cddf1ec793831d204b9b336d35be | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.ut... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | ff7b9109a3cfbd2c04f245258d0e445b | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Random;
import java.util.StringTokenizer;
public class LexicographicallyMaximumSubsequence {
static BufferedReade... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 89e98181534b64bae55bfdfe33661445 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | //package Mssolved;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class lexMaxSub {
static class pair{
int occ,start,end;
public pair(int start, int end){
this.end=end;
this.start=start;
occ=1;
}
}
public static void ... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | afef933973b7ff5b9a3061ffac501073 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | /*
*
* @Author Ajudiya_13(Bhargav Girdharbhai Ajudiya)
* Dhirubhai Ambani Institute of Information And Communication Technology
*
*/
import java.util.*;
import java.io.*;
import java.lang.*;
public class Code198
{
static class InputReader {
private final InputStream stream;
private final byte[]... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 69b0a0d904b5814e301909e85aa625fc | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.util.*;
import java.io.*;
public class abc {
static void print(Object o){
System.out.println(o);
}
static String getch(int i){
switch(i){
case (0): return "a";
case (1): return "b";
case (2): return "c";
case (3): return "d";
case (4): return "e";
case (5): return "f";
c... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | b7a98f5e8c0d0b93b3a577917e7b735d | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.regex.*;
public class Myclass {
public static ArrayList a[]=new ArrayList[300001];
public static void main(String[] args)
{
Input... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | fd51021ce4bc3accd0385e3ddffa124e | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Lexico{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String s=sc.next();
char arr[]=s.toCharArray();
int last=-1;
for(int i=122;i>=97;i--){
for(int j=0;j<arr.length;j++){
... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 6dcf6c2d1f0a7586e536b7a8fb1607ce | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | //package codeforces;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | e7006b8cfaf0d6645628cf8506a292b4 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.util.*;
import java.io.*;
public class codeforces
{
public static void main(String[] args)
{
InputReader in = new InputReader(System.in);
PrintWriter pw = new PrintWriter(System.out);
String s = in.nextLine();
int n = s.length();
Stack<Character> stack = new Stack<>();... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 345dc6f699368872877b67a9db63c169 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C124 {
public static void main(String[] args) {
MyScanner scan = new MyScanner();
String s = scan.next();
StringBuilder... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 464def1e3bc540a6adbca73be62925c2 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.util.Scanner;
public class A196 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
char[] S = in.next().toCharArray();
int lastIdx = 0;
StringBuilder sb = new StringBuilder();
for (char c = 'z'; c >= 'a'; c--) {
for (int ... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | e0acf4ce1f02e1bd82e85db3a233b0ef | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes |
import java.io.*;
import java.util.*;
public class simplex3
{
public static void main(String args[])
throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str=br.readLine();
HashMap<Character,Integer> map=new HashMap<Ch... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 394d8b90042c3d22e3bf82f7cf4691f4 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.util.*;
public class cf{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
char[] a=sc.next().toCharArray();
int n=a.length;
char curr=a[n-1];
ArrayList<Character> s=new ArrayList<>();
s.add(curr);
for(int i=n-2;i>=0;i--){
if(a[i]>=curr){
curr=a[i];
s.add(curr);
... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 193850a722515334bc3eba6e52fd2008 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | /*
Keep solving problems.
*/
import java.util.*;
import java.io.*;
public class CFA {
BufferedReader br;
PrintWriter out;
StringTokenizer st;
boolean eof;
final long MOD = 1000L * 1000L * 1000L + 7;
int[] dx = {0, -1, 0, 1};
int[] dy = {1, 0, -1, 0};
void solve() throws IOException ... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 9e05c17aa593c3fb37cc68acd2c1947c | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;
public class Lexicographicallymaximum {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
String s = input.next()... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 6cd23754bd2999ac37de1aa700e7b612 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
OutputWriter out = new OutputWriter(System.out);
String s= in.readString();
int max=0;
int[] nums = new int[26];
StringBui... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | f4a2a6889e0a59f7eafec56ab8b1d99e | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// StringTokenizer st = new StringTokenizer(br.readLine());
// int n = Integer.parseInt(st.nextToken(... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 20b71f3d41726303df074915be27d3fa | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Abood2B {
public static void main(String[] args) throws IOException {
Scanner sc = new S... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | e70853f71d86578a315a9e9bdc344129 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes |
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigIn... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 34e972989cc5655cdd2e1c1e6f19fbc6 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
public class lmse
{
//By shwetank_verma
static class FastReader
{
BufferedReader br;
StringTokenizer st; ... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 8 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | b0ff245a47dc5e1f91b0a1c2c7e583a3 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
import java.util.*;
public class CodeForces {
static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
void runCase(int caseNum) throws IOException {
String str = next();
char[] ret = new char[str.length()];
int len = 0;
char cur = 'z';
... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 6 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 5dcfcea8ff5abc4b419fc07451d67ec8 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class C {
static long[][] a;
static long[][] adj;
public static void main(String[] args) throws IOException {
InputReader in = new InputRea... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 6 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 84fbcd151da8f4e366f74f2db4d97b29 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.util.Scanner;
public class LexicographicallyMaximumSubsequence {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String x = sc.next();
StringBuilder sb = new StringBuilder();
int len = x.length();
char max = 'a';
for(int i = len-1; i >= 0; i--) {
if(x.charAt(i... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 6 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 9bcbbd128f61cd0e59ae91989dc23fe9 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
char[] s = inB.readLine().toCharArray();
int pos = 0;
StringBuilder ans = new StringBuilder();
for(char c = 'z'; c >= 'a'; c--){
for(int i = pos; i < s.length; i++){
if(s[i] == c){
pos = i;
an... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 6 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 95aedb63ad02fb6f8b336f544a43985a | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Solution {
void solve() throws IOException {
String s = nextToken();//, res = "";
final int inf = 1000000000;
int[] fpos = new int[300], lpos = n... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 6 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 8976076b299ebb2493139145bd798b99 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.Writer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author emotionalBlind
*/
public class Main {
public static void m... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 6 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 75e144cdeb08b2ead190d3c88011b5c0 | train_001.jsonl | 1339506000 | You've got string s, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.We'll call a non-empty string s[p1p2... pk] = sp1sp2... spk(1 ≤ p1 < p2 < ... < pk ≤ |s|) a subsequence of string s = s1s2... s|s|.String x = x1x2... x|x| is lexicographically larger than string y ... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;
public class ProblemA {
public static void main(String[] args) {
new ProblemA().solve();
}
private void solve() {
Scanner in = new Scanner(new BufferedInputStream(System.in));
Pri... | Java | ["ababba", "abbcbccacbbcbaaba"] | 2 seconds | ["bbba", "cccccbba"] | NoteLet's look at samples and see what the sought subsequences look like (they are marked with uppercase bold letters).The first sample: aBaBBAThe second sample: abbCbCCaCbbCBaaBA | Java 6 | standard input | [
"greedy",
"strings"
] | 77e2a6ba510987ed514fed3bd547b5ab | The single line contains a non-empty string s, consisting only of lowercase English letters. The string's length doesn't exceed 105. | 1,100 | Print the lexicographically maximum subsequence of string s. | standard output | |
PASSED | 452d892f4f88e03827310fc91c3b3cc7 | train_001.jsonl | 1409061600 | Appleman has a very big sheet of paper. This sheet has a form of rectangle with dimensions 1 × n. Your task is help Appleman with folding of such a sheet. Actually, you need to perform q queries. Each query will have one of the following types: Fold the sheet of paper at position pi. After this query the leftmost part... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
MyInput in = new MyInput(System.in);
PrintWriter out = new PrintWriter(System.out);
Solver solver = new Solver();
int testCase = 1;
try {
while (true... | Java | ["7 4\n1 3\n1 2\n2 0 1\n2 1 2", "10 9\n2 2 9\n1 1\n2 0 1\n1 8\n2 0 8\n1 2\n2 1 3\n1 4\n2 2 4"] | 2 seconds | ["4\n3", "7\n2\n10\n4\n5"] | NoteThe pictures below show the shapes of the paper during the queries of the first example: After the first fold operation the sheet has width equal to 4, after the second one the width of the sheet equals to 2. | Java 7 | standard input | [
"data structures",
"implementation"
] | 19d9a438bf6353638b08252b030c407b | The first line contains two integers: n and q (1 ≤ n ≤ 105; 1 ≤ q ≤ 105) — the width of the paper and the number of queries. Each of the following q lines contains one of the described queries in the following format: "1 pi" (1 ≤ pi < [current width of sheet]) — the first type query. "2 li ri" (0 ≤ li < ri ≤ ... | 2,200 | For each query of the second type, output the answer. | standard output | |
PASSED | 199d0e323fe264d73067ecd7af889383 | train_001.jsonl | 1409061600 | Appleman has a very big sheet of paper. This sheet has a form of rectangle with dimensions 1 × n. Your task is help Appleman with folding of such a sheet. Actually, you need to perform q queries. Each query will have one of the following types: Fold the sheet of paper at position pi. After this query the leftmost part... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public cla... | Java | ["7 4\n1 3\n1 2\n2 0 1\n2 1 2", "10 9\n2 2 9\n1 1\n2 0 1\n1 8\n2 0 8\n1 2\n2 1 3\n1 4\n2 2 4"] | 2 seconds | ["4\n3", "7\n2\n10\n4\n5"] | NoteThe pictures below show the shapes of the paper during the queries of the first example: After the first fold operation the sheet has width equal to 4, after the second one the width of the sheet equals to 2. | Java 7 | standard input | [
"data structures",
"implementation"
] | 19d9a438bf6353638b08252b030c407b | The first line contains two integers: n and q (1 ≤ n ≤ 105; 1 ≤ q ≤ 105) — the width of the paper and the number of queries. Each of the following q lines contains one of the described queries in the following format: "1 pi" (1 ≤ pi < [current width of sheet]) — the first type query. "2 li ri" (0 ≤ li < ri ≤ ... | 2,200 | For each query of the second type, output the answer. | standard output | |
PASSED | 9b5e036d7d011eaba5fdb406d0eb6de0 | train_001.jsonl | 1409061600 | Appleman has a very big sheet of paper. This sheet has a form of rectangle with dimensions 1 × n. Your task is help Appleman with folding of such a sheet. Actually, you need to perform q queries. Each query will have one of the following types: Fold the sheet of paper at position pi. After this query the leftmost part... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
void add(int[] count, int k, int v) {
int n = count.length;
for (; k < n; k += -k & k) {
count[k] += v;
}
}
int ask(int[] count, int k) {
int result = 0;
for (; k > 0; k -= -k ... | Java | ["7 4\n1 3\n1 2\n2 0 1\n2 1 2", "10 9\n2 2 9\n1 1\n2 0 1\n1 8\n2 0 8\n1 2\n2 1 3\n1 4\n2 2 4"] | 2 seconds | ["4\n3", "7\n2\n10\n4\n5"] | NoteThe pictures below show the shapes of the paper during the queries of the first example: After the first fold operation the sheet has width equal to 4, after the second one the width of the sheet equals to 2. | Java 7 | standard input | [
"data structures",
"implementation"
] | 19d9a438bf6353638b08252b030c407b | The first line contains two integers: n and q (1 ≤ n ≤ 105; 1 ≤ q ≤ 105) — the width of the paper and the number of queries. Each of the following q lines contains one of the described queries in the following format: "1 pi" (1 ≤ pi < [current width of sheet]) — the first type query. "2 li ri" (0 ≤ li < ri ≤ ... | 2,200 | For each query of the second type, output the answer. | standard output | |
PASSED | 7493805b3d541f5dedf53b5fce617cff | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes |
import java.io.*;
import java.util.HashSet;
import java.util.StringTokenizer;
public class Task1 {
static class FastScanner {
BufferedReader br;
StringTokenizer st;
FastScanner(File f) {
try {
br = new BufferedReader(new FileReader(f));
} catch (F... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | d4a795fde7c291a7f5d25b443c548a33 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.io.*;
import java.util.*;
/*
* To execute Java, please define "static void main" on a class
* named Solution.
*
* If you need more classes, simply define them inline.
*/
public class CellsNotUnderAttack {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int ... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 8b6a9bd1dc0cd52b6a332d8c212a8e7b | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes |
import java.util.*;
import java.io.*;
public class main {
public class nm {
int m;
int n;
nm(int n, int m) {
this.m = m;
this.n = n;
}
}
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
main obj = new main();
nm ar... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 99c68a6f32b2507d636292ec55837075 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | // Java Bootcamp Day 1, Problem F
import java.io.*;
import java.nio.charset.Charset;
import java.util.HashSet;
public class Main {
public static void main(String[] args) {
Charset charset = Charset.forName("ascii");
FastIO rd = new FastIO(System.in, System.out, charset);
int n = rd.readInt(); // ... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 251d7b3a53eef96ac512bf39acdc52d0 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.util.*;
public class CellsNotUnderAttack1 {
public static void main (String[] args) {
Scanner input = new Scanner(System.in);
String[] nm = input.nextLine().split(" ");
int n = Integer.parseInt(nm[0]);
int m = Integer.parseInt(nm[1]);... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 135037fb66fc598da7bf32fe1dfbf8b2 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class Codeforces {
public st... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | b9c2384f3c10334cb1728de389c4586c | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class Codeforces {
public st... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 01897282ce7e4aaeea9691d17deb1c70 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Solution
{
// Complete the maximumSum function below.
public static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | cce4f80d87092b673ff68197b26123db | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | // Java Bootcamp Day 1, Problem F
import java.io.*;
import java.nio.charset.Charset;
import java.util.HashSet;
public class Main {
public static void main(String[] args) {
Charset charset = Charset.forName("ascii");
FastIO rd = new FastIO(System.in, System.out, charset);
int n = rd.readInt(); // ... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 2f50ad2d4691818fd16a34c9a4e8458d | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
long n,m,rowks=0,colrks=0,total,r,c;
Scanner s= new Scanner(System.in);
n=s.nextLong();
m=s.nextLong();
total=n*n;
int r_arr[]=new int[(int)n];
int c_arr[]=new int[(int)n];
for(long i... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 2b6545a6c8f4f9ea4858c4c9140db63d | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class B {
static int[] a = new int[100000];
static int[] b = new int[100000];
public static void main(String[] args) throws IOException{
FastScanner sc = new FastScanner();
// int yo = sc.nextInt();
// while(yo-->0) {
// }
lo... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 869ac5cb7923a18d066f6a38ccebca89 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
//sca
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next() {
... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | f08adf27a1625925ae981f9a0b4ed9d0 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import com.sun.jdi.ArrayReference;
import jdk.swing.interop.SwingInterOpUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.*;
public class Main {
public s... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 2c45c0f0f798a7aa900bd608f80a2c21 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | //Written by Shagoto
import java.util.*;
import java.io.*;
public class Main
{
public static void main(String[]args) throws IOException
{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader read = new BufferedReader(isr);
String initial = read.readLine();
String [] temp1 = ... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 9368dbb119a240bb9f1cdbe6071ed347 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | //Written by Shagoto
import java.util.*;
public class Main
{
public static void main(String[]args)
{
Scanner read = new Scanner(System.in);
long n = read.nextLong();
long total = n*n;
long m = read.nextLong();
HashSet<Long> row = new HashSet<Long>();
HashSet<Long> col = new HashSet<Long... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | e9518c0fea52a95694f844fc696a4d55 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Codeforces{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long x=sc.nextInt();
long y=x;
int m=sc.nextInt();
Map<Long,Integer> ax=new HashMap<>();
Map<Long,Integer> ay=new HashMap<... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | a85d722027b22da9f3fd7d1b7bd352f1 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.util.*;
import java.io.*;
public class solution {
public static void merge(long arr[], int l, int m, int r) {
// Find sizes of two subarrays to be merged
int n1 = m - l + 1;
int n2 = r - m;
/* Create temp arrays */
long L[] = new long[n1];
long R[] = new... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | ca5bcfbf9d392fad62109b0f6a389bf8 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
import java.text.*;
public class A{
static FastReader scan=new FastReader();
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
static int d,n,m;
static int arr[];
public static void main(String[] args) thr... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 855856079c596139c88f65893de79326 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Scanner;
import static java.lang.String.valueOf;
public class Solve {
public static void main(String[] args) {
var x = new HashSet<Integer>();
var y = new HashSet<Integer>();
var sc = new Scan... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 97f2c175649e54bd6425926360aa6bf1 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.*;
/**
*
* @author Bryan AW
*/
public class Codeforces {
/**
* @param args the command line arguments
... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 579d5ddd7e6aa2b7a696b7e81d6e6a4b | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.util.HashSet;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
long n = input.nextLong();
long m = input.nextLong();
HashSet <Long> positionX = new HashSet<>();
HashSet <Long> positionY = ... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 668b247fd45ad517f9fd43a23872096b | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.util.*;
public class underattack {
public static void main(String [] args){
Scanner s = new Scanner(System.in);
int size = s.nextInt();
HashSet<Integer> row = new HashSet();
HashSet<Integer> column = new HashSet();
int numP = s.nextInt();
int temp;
... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | f285f6000e38c785d1814a02b81c9165 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
final static long mod = 1000000007;
static void debug(Object... args) {
System.out.println(Arrays.deepToString(args));
}
public static void main(String[] args) throws Exception {
InputReader sc = new InputReader(System.in);
... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | f412200c05e1727226a37d77a7acd2a7 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
final static long mod = 1000000007;
static void debug(Object... args) {
System.out.println(Arrays.deepToString(args));
}
public static void main(String[] args) throws Exception {
InputReader sc = new InputReader(System.in);
... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 9e747a497a95c6de6833d8e115ae9068 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | import java.math.BigInteger;
import java.util.Scanner;
import java.util.*;
public class java_main{
public static Scanner in=new Scanner(System.in);
public static void main(String[] args){
String n=in.next();
long m=in.nextLong();
BigInteger N=new BigInteger(n);
Set<Long> x = new HashSet... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 78d06e5a9c8dc557b5698f0a7207f5f5 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | /* Solution for:https://codeforces.com/problemset/problem/427/B*/
import java.util.*;
import java.io.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.InputStream;
import j... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 8eea3ebc98b44bf1f77e47f0dffeea01 | train_001.jsonl | 1469205300 | Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another.The cell of the field is under rook's attack, if there is at least one rook located in the same row or in the same column with this cell. If there is a rook ... | 256 megabytes | // package cp;
import java.io.*;
import java.math.*;
import java.util.*;
public class Cf_one {
public static void main(String[] args) throws IOException {
PrintWriter out = new PrintWriter(System.out);
Readers.init(System.in);
int n=Readers.nextInt();
int m=Readers.nextInt();
int[] rows=new int[n];
int... | Java | ["3 3\n1 1\n3 1\n2 2", "5 2\n1 5\n5 1", "100000 1\n300 400"] | 2 seconds | ["4 2 0", "16 9", "9999800001"] | NoteOn the picture below show the state of the board after put each of the three rooks. The cells which painted with grey color is not under the attack. | Java 11 | standard input | [
"data structures",
"math"
] | faf1abdeb6f0cf34972d5cb981116186 | The first line of the input contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ min(100 000, n2)) — the size of the board and the number of rooks. Each of the next m lines contains integers xi and yi (1 ≤ xi, yi ≤ n) — the number of the row and the number of the column where Vasya will put the i-th rook. Vasya put... | 1,200 | Print m integer, the i-th of them should be equal to the number of cells that are not under attack after first i rooks are put. | standard output | |
PASSED | 37c1cd745acf7824b3d31417c7c0323b | train_001.jsonl | 1495877700 | In his spare time Vladik estimates beauty of the flags.Every flag could be represented as the matrix n × m which consists of positive integers.Let's define the beauty of the flag as number of components in its matrix. We call component a set of cells with same numbers and between any pair of cells from that set there e... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class VladikEntertainingFlags {
int N = (int) 1e6 + 10;
int n, m, q;
int[][] a;
... | Java | ["4 5 4\n1 1 1 1 1\n1 2 2 3 3\n1 1 1 2 5\n4 4 5 5 5\n1 5\n2 5\n1 2\n4 5"] | 2 seconds | ["6\n7\n3\n4"] | NotePartitioning on components for every segment from first test case: | Java 8 | standard input | [
"data structures",
"dsu",
"graphs"
] | 167594e0be56b9d93e62258eb052fdc3 | First line contains three space-separated integers n, m, q (1 ≤ n ≤ 10, 1 ≤ m, q ≤ 105) — dimensions of flag matrix and number of segments respectively. Each of next n lines contains m space-separated integers — description of flag matrix. All elements of flag matrix is positive integers not exceeding 106. Each of next... | 2,600 | For each segment print the result on the corresponding line. | standard output | |
PASSED | 4696bd0e21037473f07bf2a8f0b517b6 | train_001.jsonl | 1495877700 | In his spare time Vladik estimates beauty of the flags.Every flag could be represented as the matrix n × m which consists of positive integers.Let's define the beauty of the flag as number of components in its matrix. We call component a set of cells with same numbers and between any pair of cells from that set there e... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class VladikEntertainingFlags2 {
int N = (int) 1e6 + 10;
int n, m, q;
int[][] a;
int id = 0;
Nod... | Java | ["4 5 4\n1 1 1 1 1\n1 2 2 3 3\n1 1 1 2 5\n4 4 5 5 5\n1 5\n2 5\n1 2\n4 5"] | 2 seconds | ["6\n7\n3\n4"] | NotePartitioning on components for every segment from first test case: | Java 8 | standard input | [
"data structures",
"dsu",
"graphs"
] | 167594e0be56b9d93e62258eb052fdc3 | First line contains three space-separated integers n, m, q (1 ≤ n ≤ 10, 1 ≤ m, q ≤ 105) — dimensions of flag matrix and number of segments respectively. Each of next n lines contains m space-separated integers — description of flag matrix. All elements of flag matrix is positive integers not exceeding 106. Each of next... | 2,600 | For each segment print the result on the corresponding line. | standard output | |
PASSED | 1bd78ead4964d260bcd460b1d29a237c | train_001.jsonl | 1495877700 | In his spare time Vladik estimates beauty of the flags.Every flag could be represented as the matrix n × m which consists of positive integers.Let's define the beauty of the flag as number of components in its matrix. We call component a set of cells with same numbers and between any pair of cells from that set there e... | 256 megabytes | import java.io.*;
import java.util.*;
public class E416 {
static int n;
static int m;
static int flag[][];
static ArrayList<Node> tree;
public static void main(String[] args) {
InputReader sc = new InputReader(System.in);
OutputWriter out = new OutputWriter(System.out);
n = s... | Java | ["4 5 4\n1 1 1 1 1\n1 2 2 3 3\n1 1 1 2 5\n4 4 5 5 5\n1 5\n2 5\n1 2\n4 5"] | 2 seconds | ["6\n7\n3\n4"] | NotePartitioning on components for every segment from first test case: | Java 8 | standard input | [
"data structures",
"dsu",
"graphs"
] | 167594e0be56b9d93e62258eb052fdc3 | First line contains three space-separated integers n, m, q (1 ≤ n ≤ 10, 1 ≤ m, q ≤ 105) — dimensions of flag matrix and number of segments respectively. Each of next n lines contains m space-separated integers — description of flag matrix. All elements of flag matrix is positive integers not exceeding 106. Each of next... | 2,600 | For each segment print the result on the corresponding line. | standard output | |
PASSED | 215208bdc3ea2f23fa76573dda29aabd | train_001.jsonl | 1495877700 | In his spare time Vladik estimates beauty of the flags.Every flag could be represented as the matrix n × m which consists of positive integers.Let's define the beauty of the flag as number of components in its matrix. We call component a set of cells with same numbers and between any pair of cells from that set there e... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class e
{
static int n, m, id, data[][];
public static void main(String args[])
{
FastScan... | Java | ["4 5 4\n1 1 1 1 1\n1 2 2 3 3\n1 1 1 2 5\n4 4 5 5 5\n1 5\n2 5\n1 2\n4 5"] | 2 seconds | ["6\n7\n3\n4"] | NotePartitioning on components for every segment from first test case: | Java 8 | standard input | [
"data structures",
"dsu",
"graphs"
] | 167594e0be56b9d93e62258eb052fdc3 | First line contains three space-separated integers n, m, q (1 ≤ n ≤ 10, 1 ≤ m, q ≤ 105) — dimensions of flag matrix and number of segments respectively. Each of next n lines contains m space-separated integers — description of flag matrix. All elements of flag matrix is positive integers not exceeding 106. Each of next... | 2,600 | For each segment print the result on the corresponding line. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.