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
8dafa6c3aa5b01b56ab1de46cabf9c1d
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class C { static BufferedReader stdin = new BufferedReader( new InputStreamReader(System.in)); static StringTokenizer st = new StringTokenizer(""); public static void main(String[] args) throws Exceptio...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
f82c3d8006d12bfaf67ffcf16a2b2a15
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.util.ArrayList; import java.util.Map; import java.util.Scanner; import java.util.TreeMap; public class Main { public void solve() { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); TreeMap<Integer, Integer> cnt = new TreeMap<>(); for (int i = 0; i < n * n; ++i) { int x = -...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
43ec39533e6a1722ded36097d10d0d7b
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.util.Map.Entry; import java.util.Scanner; import java.util.TreeMap; public class C { /* 4 2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2 2 1 1 1 1 4 3 3 3 3 2 2 2 2 1 1 1 1 1 1 1 1 */ public static void main(String[] args) { Scanner reader = new Scanner(System.in); int n = reader.nextInt(); /* int[][] g...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
b04901f69532bc2729df26c71f701aac
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Map; import java.util.StringTokenizer; import java.util.TreeMap; /** * @author Don Li */ public class GCDTable { void solve() { int n = in.nextInt(); Map<Integ...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
279bb5d94272958d66030b83d41e1c56
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.util.*; public class Main { public static int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); } private static class St { int number, count; public St(int number, int count) { this.number = number; this.count = count; } } ...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
84f38f6fa38e9535b910c73d28361bd5
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
//package com.codeforces.competitions.year2015.octobertodecember.round323div2; import java.io.*; import java.util.*; public final class Third { static int n, arr[]; static InputReader in; static OutputWriter out; public static void main(String[] args) { Third third = new Third(); in = third.new InputReader...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
cc56621eeb860dbcda76592907441372
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Scanner; import java.util.TreeSet; /** * * @author sarthak */ public class rnd323_C { public static long gcd(long a, long b) { if (b == 0) { return a; } if (b > a) { ...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
8c89b686a5d282f10782731532f907d4
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.util.*; public class Main{ public static void main(String args[]){ Scanner in = new Scanner(System.in); Map<Integer, Integer> mp = new HashMap<Integer, Integer>(); int n = in.nextInt(); int[] a = new int[n*n]; for(int i=0;i<n*n;i++){ a[i] = in.nextInt(); if(mp.get(a[i]) == null) mp.put(...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
d8a1ef522bf8371c284b5a7d19a2df98
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.io.*; import java.util.*; public class CF583C { static int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } static void remove(TreeMap<Integer, Integer> map, int v) { int cnt = map.get(v); if (cnt == 1) map.remove(v); else map.put(v, cnt - 1); } public static void main(String[] a...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
3baed3a04dab68df6b68fdffcc6d655f
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.io.*; import java.util.*; public class C { int[] v, c, a; int k, r; int gcd(int a, int b) { return a == 0 ? b : gcd(b % a, a); } void add(int e) { for (int i = 0; i < r; ++i) { int g = gcd(e, a[i]); int t = 0; while (t < k && g != v...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
61ac026c3a1cfee1c75a19e4b448f86f
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; public class Codeforces { private static BufferedReader br; private static StringTokenizer st; pri...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
f708997d78591afbae4b406ee87b01c2
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; /** * * @author ploskov */ public class Codeforces { private static StreamToken...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
9b4aeb737c0c18b21ac8c878633fff0c
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.util.ArrayList; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.TreeMap; public class CF583C ...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
1cdf38055ecc2ba1af38337cef89d5fc
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class Contest { public static void main(String[] args) { Map<Integer, Integer> map = new HashMap<>(); List<Integer> result = new Arr...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
9eeb78771e1ab750ffe07b5b09895309
train_000.jsonl
1443890700
The GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x and y is the greatest integer that is divisor of both x and y, it is denoted as . For example, for array a = {4, 3, 6, 2} of length 4 ...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class Contest { public static void main(String[] args) { List<Integer> divisors = new ArrayList<>(); Map<Integer, Integer> map = new...
Java
["4\n2 1 2 3 4 3 2 6 1 1 2 2 1 2 3 2", "1\n42", "2\n1 1 1 1"]
2 seconds
["4 3 6 2", "42", "1 1"]
null
Java 8
standard input
[ "constructive algorithms", "number theory" ]
71dc07f0ea8962f23457af1d6509aeee
The first line contains number n (1 ≤ n ≤ 500) — the length of array a. The second line contains n2 space-separated numbers — the elements of the GCD table of G for array a. All the numbers in the table are positive integers, not exceeding 109. Note that the elements are given in an arbitrary order. It is guaranteed t...
1,700
In the single line print n positive integers — the elements of array a. If there are multiple possible solutions, you are allowed to print any of them.
standard output
PASSED
cee32aad2fd8c07090c2bf69e31ad687
train_000.jsonl
1397977200
The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke.R2 has m Spyke chats just to discuss all sorts of issues. In each chat, some group of employees exchanges messa...
256 megabytes
import java.io.*; import java.util.*; public final class Template { public static void main(String[] args) { FastScanner sc = new FastScanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); int employeeDetails[][] = new int[n][m]; for (int i =...
Java
["3 4 5\n1 1 1 1\n1 0 1 1\n1 1 0 0\n1 1\n3 1\n1 3\n2 4\n3 2", "4 3 4\n0 1 1\n1 0 1\n1 1 1\n0 0 0\n1 2\n2 1\n3 1\n1 3"]
1 second
["3 3 1", "0 2 3 0"]
null
Java 11
standard input
[ "implementation" ]
fad203b52e11706d70e9b2954c295f70
The first line contains three space-separated integers n, m and k (2 ≤ n ≤ 2·104; 1 ≤ m ≤ 10; 1 ≤ k ≤ 2·105) — the number of the employees, the number of chats and the number of events in the log, correspondingly. Next n lines contain matrix a of size n × m, consisting of numbers zero and one. The element of this matr...
1,300
Print in the single line n space-separated integers, where the i-th integer shows the number of message notifications the i-th employee receives.
standard output
PASSED
17322687a5131755f0c05a10a8194616
train_000.jsonl
1397977200
The R2 company has n employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke.R2 has m Spyke chats just to discuss all sorts of issues. In each chat, some group of employees exchanges messa...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class SpykeChatting { public static void main(String[] args) { int n = fs.nextInt(), m = fs.nextInt(), k = fs.nextInt(); int[][] employeeToChat = new int[n][]; ...
Java
["3 4 5\n1 1 1 1\n1 0 1 1\n1 1 0 0\n1 1\n3 1\n1 3\n2 4\n3 2", "4 3 4\n0 1 1\n1 0 1\n1 1 1\n0 0 0\n1 2\n2 1\n3 1\n1 3"]
1 second
["3 3 1", "0 2 3 0"]
null
Java 11
standard input
[ "implementation" ]
fad203b52e11706d70e9b2954c295f70
The first line contains three space-separated integers n, m and k (2 ≤ n ≤ 2·104; 1 ≤ m ≤ 10; 1 ≤ k ≤ 2·105) — the number of the employees, the number of chats and the number of events in the log, correspondingly. Next n lines contain matrix a of size n × m, consisting of numbers zero and one. The element of this matr...
1,300
Print in the single line n space-separated integers, where the i-th integer shows the number of message notifications the i-th employee receives.
standard output
PASSED
e6092062d04df2f5d889af6cd8cd4ace
train_000.jsonl
1289646000
Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin...
256 megabytes
import java.lang.*; import java.util.*; public class Cost{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[] arr=new int[n]; int negCount=0; int negMax=-100; int posCount=0; for(int i=0; i<n; i++){ ...
Java
["5\n1 2 -3 3 3", "13\n100 100 100 100 100 100 100 100 100 100 100 100 100", "4\n-2 -2 -2 -2"]
2 seconds
["3 1 2 3", "100 100 100 100 100 100 100 100 100 100 100 100 100", "-2 -2 -2 -2"]
null
Java 11
standard input
[ "greedy" ]
b11644953bdd1b92eb1b18c339a268a1
The first line contains an integer n (1 ≤ n ≤ 100) — the number of the suggested problems. The next line contains n space-separated integers ci ( - 100 ≤ ci ≤ 100) — the cost of the i-th task. The tasks' costs may coinсide.
1,400
Print space-separated the costs of the problems that needed to be solved to get the maximal possible number of points. Do not forget, please, that it was necessary to solve at least one problem. If there are several solutions to that problem, print any of them.
standard output
PASSED
1649622eeaca5833de2fad776cab143b
train_000.jsonl
1289646000
Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin...
256 megabytes
import java.lang.*; import java.util.*; public class Cost{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[] arr=new int[n]; int negCount=0; int negMax=-100; int posCount=0; for(int i=0; i<n; i++){ ...
Java
["5\n1 2 -3 3 3", "13\n100 100 100 100 100 100 100 100 100 100 100 100 100", "4\n-2 -2 -2 -2"]
2 seconds
["3 1 2 3", "100 100 100 100 100 100 100 100 100 100 100 100 100", "-2 -2 -2 -2"]
null
Java 11
standard input
[ "greedy" ]
b11644953bdd1b92eb1b18c339a268a1
The first line contains an integer n (1 ≤ n ≤ 100) — the number of the suggested problems. The next line contains n space-separated integers ci ( - 100 ≤ ci ≤ 100) — the cost of the i-th task. The tasks' costs may coinсide.
1,400
Print space-separated the costs of the problems that needed to be solved to get the maximal possible number of points. Do not forget, please, that it was necessary to solve at least one problem. If there are several solutions to that problem, print any of them.
standard output
PASSED
63d8fb2722dc8e48d2109b3035d5b240
train_000.jsonl
1289646000
Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin...
256 megabytes
import java.io.*; import java.util.*; public class MyClass { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == n...
Java
["5\n1 2 -3 3 3", "13\n100 100 100 100 100 100 100 100 100 100 100 100 100", "4\n-2 -2 -2 -2"]
2 seconds
["3 1 2 3", "100 100 100 100 100 100 100 100 100 100 100 100 100", "-2 -2 -2 -2"]
null
Java 11
standard input
[ "greedy" ]
b11644953bdd1b92eb1b18c339a268a1
The first line contains an integer n (1 ≤ n ≤ 100) — the number of the suggested problems. The next line contains n space-separated integers ci ( - 100 ≤ ci ≤ 100) — the cost of the i-th task. The tasks' costs may coinсide.
1,400
Print space-separated the costs of the problems that needed to be solved to get the maximal possible number of points. Do not forget, please, that it was necessary to solve at least one problem. If there are several solutions to that problem, print any of them.
standard output
PASSED
241a0d31706e8ccfaa346484eef130b9
train_000.jsonl
1289646000
Vasya has gotten interested in programming contests in TCMCF+++ rules. On the contest n problems were suggested and every problem had a cost — a certain integral number of points (perhaps, negative or even equal to zero). According to TCMCF+++ rules, only accepted problems can earn points and the overall number of poin...
256 megabytes
import java.io.*; import java.util.*; //import java.math.*; // for bigInteger public class Main { public static void main(String args[]) throws Exception { InputReader sc = new InputReader(); PrintWriter out = new PrintWriter(System.out); int t=1; //t = sc.nextInt(); for(int tt=...
Java
["5\n1 2 -3 3 3", "13\n100 100 100 100 100 100 100 100 100 100 100 100 100", "4\n-2 -2 -2 -2"]
2 seconds
["3 1 2 3", "100 100 100 100 100 100 100 100 100 100 100 100 100", "-2 -2 -2 -2"]
null
Java 11
standard input
[ "greedy" ]
b11644953bdd1b92eb1b18c339a268a1
The first line contains an integer n (1 ≤ n ≤ 100) — the number of the suggested problems. The next line contains n space-separated integers ci ( - 100 ≤ ci ≤ 100) — the cost of the i-th task. The tasks' costs may coinсide.
1,400
Print space-separated the costs of the problems that needed to be solved to get the maximal possible number of points. Do not forget, please, that it was necessary to solve at least one problem. If there are several solutions to that problem, print any of them.
standard output
PASSED
d1295423254d16fbd71a35f6f5a5aa06
train_000.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintStream out = System.out; TaskC taskC = new TaskC(); taskC.solve(in, out); } static class TaskC { int N, K, A, B; ...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
5ba433092447af00290ddc33f1241edc
train_000.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
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 p1111C { static int A; static int B; public static void main(String[] args) throws IOException { BufferedR...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
f28825224701e3e36cde47f6bb210961
train_000.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Set; import java.util.StringTokenizer; import java.util.TreeSet; import java.util.stream.IntStream; public class C { public static void main(String[] args) throws IOException { try (Input input = new StandardInput(); PrintWriter writer = new Print...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
4d898554b31175b0da53b3d8ec92e40b
train_000.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.util.Scanner; import java.util.TreeMap; public class C { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); int A = s.nextInt(); int B = s.nextInt(); TreeMap<Integer, Integer> positions ...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
5fd4707a802f8e8452ff9be1589e1a68
train_000.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.TreeSet; @SuppressWarnings("Duplicates") public class ProblemCnorm { public static long n, numAvengers, Acon, Bcon; ...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
5a691ad4fb1381cde5f65bae14626e95
train_000.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.util.Arrays; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.Scanner; public class CreativeSnap { static int N; static int A; static int B; static int[] POS; static int[] SUM; static Map<Integer, Integer> COUNT; public static void m...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
b5e6668263d0f2087e7979761991d82a
train_000.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Solution{ static int A; static int B; public static int bSearch(int[] a, int low, int high,int val){ int ans = high+1; while(low <= high){ int mid = (low+high)/2; ...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
4f1b55b638cc26e5a76bc15f8f0c6464
train_000.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ static long A; static long B; public static int bSearch(int[] a, int low, int high,int val){ int ans = high+1; while(low <= high){ int mid = (low+high)/2; if(a[mid]...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
cb514b4423b83143c45b29c395e83058
train_000.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
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.InputMismatchException; import java.util.TreeMap...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
1d6545123f4b49c83746d911189981c0
train_000.jsonl
1549208100
Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, but one avenger can occupy only one position. Length of their base is a perfect power of $$$2$$$. Thanos wants to destroy...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class C1111 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int A = scanner.nextInt(); int B = scanner.nextInt(); int...
Java
["2 2 1 2\n1 3", "3 2 1 2\n1 7"]
1 second
["6", "8"]
NoteConsider the first example.One option for Thanos is to burn the whole base $$$1-4$$$ with power $$$2 \cdot 2 \cdot 4 = 16$$$.Otherwise he can divide the base into two parts $$$1-2$$$ and $$$3-4$$$.For base $$$1-2$$$, he can either burn it with power $$$2 \cdot 1 \cdot 2 = 4$$$ or divide it into $$$2$$$ parts $$$1-1...
Java 8
standard input
[ "binary search", "divide and conquer", "brute force", "math" ]
4695aa2b3590a0734ef2c6c580e471a9
The first line contains four integers $$$n$$$, $$$k$$$, $$$A$$$ and $$$B$$$ ($$$1 \leq n \leq 30$$$, $$$1 \leq k \leq 10^5$$$, $$$1 \leq A,B \leq 10^4$$$), where $$$2^n$$$ is the length of the base, $$$k$$$ is the number of avengers and $$$A$$$ and $$$B$$$ are the constants explained in the question. The second line co...
1,700
Output one integer — the minimum power needed to destroy the avengers base.
standard output
PASSED
221545a1968d4b8cc70718b5d51f354d
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.io.*; import java.util.*; public class R150qB { @SuppressWarnings("unchecked") public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); int m = in.nextInt(); int...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 8
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
566e3aaf62fa56620b382c97cd6c3969
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.io.*; import java.util.*; public class Main { void solve() { int n = in.nextInt(); int m = in.nextInt(); int h = in.nextInt(); int t = in.nextInt(); ArrayList<Integer>[] g = new ArrayList[n]; for (int i = 0; i < n; ++i) { g[i] = new ArrayList<>(); } for (int i = 0; i < m; ++i) { in...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 8
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
3fc68888663032eb8ea86bd1d7d33165
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; public class test{ // ArrayList<Integer> lis = new ArrayList<Integer>(); // ArrayList<String> lis = new ArrayList<String>(); // PriorityQueue<Integer...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
1af8d6866e6bc32df38bc67e25f251ac
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.Random; import java.util.StringTokenizer; import java.util.TreeSet; public class BB { public static ...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
9d95b0a61e563506b8504f9db772d1a6
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashSet; import java.util.Random; import java.util.StringTokenizer; import java.util.TreeSet; public class Hydra { public stat...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
57afa970a0a03b5b59927045e5eaf3e6
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out)); ...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
f0e81b594628c094bd938a7a618484de
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashSet; import java.util.Random; import java.util.Set; import java.util.StringTokenizer...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
81a596f8e67de7b03c3c497e3ed08d86
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.io.* ; import java.util.*; import static java.lang.Math.* ; import static java.util.Arrays.* ; public class B { public static void main(String[] args) throws IOException { // out.println("300 597 100 100"); // for( int i = 2; i < 300; i++){ // out.println(1 + " " + (1+i)); // ...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
88aeba51515173af8b625530dd1d4098
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.util.Comparator; import java.io.OutputStream; import java.util.RandomAccess; import java.io.PrintWriter; import java.util.AbstractList; import java.io.Writer; import java.util.List; import java.io.IOException; import java.util.Arrays; import ...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
01330411300f520703c90efdb7b14410
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.io.*; import java.util.*; public class Solution { private StringTokenizer st; private BufferedReader in; private PrintWriter out; private long[][] nsBig; private int[][] nsLst; public void solve() throws IOException { int n = nextInt(); int m = nextInt(); int u = nextInt(); int v = nextInt...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
479be76c7e452235eefd71cc9ba15d1e
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.util.InputMismatchException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Reader; import java.io.Writer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution ...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
7834ae1c854a029909171cff0b579717
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) throws IOException{ BufferedReader rd = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(System.out); StringTokenizer st = new StringTokenizer(rd.readLine()); N = Integer.parseIn...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
ebed7120411cd929def2e55dfaec7af5
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
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.HashSet; import java.util.Set; public class ProblemB { static int[][] graph; static int[] deg; static int H, T, N; public static void main(String[] ...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
247e8b210200cb14da77309bdcb166b8
train_000.jsonl
1353079800
One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph.A non-oriented graph is a hydra, if it has a structure, shown on the figure below. Namely, there are two nodes u and v connected by an edge, they are the hydra's che...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { (new Main()).solve(); } void solve() { Scanner cin = new Scanner(System.in); MAIN: while( cin.hasNextInt() ) { int N = cin.nextInt(); int M = cin.nextInt(); int H = cin.nextInt(); int T = c...
Java
["9 12 2 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5\n8 7\n9 1", "7 10 3 3\n1 2\n2 3\n1 3\n1 4\n2 5\n4 5\n4 6\n6 5\n6 7\n7 5"]
2 seconds
["YES\n4 1\n5 6 \n9 3 2", "NO"]
NoteThe first sample is depicted on the picture below:
Java 6
standard input
[ "sortings", "graphs" ]
2d098058a553a70f30977266059f01c2
The first line contains four integers n, m, h, t (1 ≤ n, m ≤ 105, 1 ≤ h, t ≤ 100) — the number of nodes and edges in graph G, and the number of a hydra's heads and tails. Next m lines contain the description of the edges of graph G. The i-th of these lines contains two integers ai and bi (1 ≤ ai, bi ≤ n, a ≠ b) — the n...
2,000
If graph G has no hydra, print "NO" (without the quotes). Otherwise, in the first line print "YES" (without the quotes). In the second line print two integers — the numbers of nodes u and v. In the third line print h numbers — the numbers of the nodes that are the heads. In the fourth line print t numbers — the numbers...
standard output
PASSED
babd7d59f1d6ab9a5fd4dbf6e1688989
train_000.jsonl
1442939400
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
256 megabytes
import java.io.*; public class First { public static void main(String[] args) throws IOException { int n; int x, y; int max = 1; int count = 1; n = nextInt(); y = nextInt(); while (--n > 0) { x = y; y = nextInt(); if (y...
Java
["6\n2 2 1 3 4 1", "3\n2 2 9"]
2 seconds
["3", "3"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
Java 7
standard input
[ "dp", "implementation", "brute force" ]
1312b680d43febdc7898ffb0753a9950
The first line contains integer n (1 ≤ n ≤ 105). The second line contains n integers a1,  a2,  ...,  an (1 ≤ ai ≤ 109).
900
Print a single integer — the length of the maximum non-decreasing subsegment of sequence a.
standard output
PASSED
31437a7c0c3dbf8ad2c3cf6f95142d1c
train_000.jsonl
1442939400
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
256 megabytes
import java.util.Scanner; public class First { public static void main(String[] args) { int n; int x, y; int max = 1; int count = 1; Scanner sc = new Scanner(System.in); n = sc.nextInt(); y = sc.nextInt(); while (--n > 0) { x = y; ...
Java
["6\n2 2 1 3 4 1", "3\n2 2 9"]
2 seconds
["3", "3"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
Java 7
standard input
[ "dp", "implementation", "brute force" ]
1312b680d43febdc7898ffb0753a9950
The first line contains integer n (1 ≤ n ≤ 105). The second line contains n integers a1,  a2,  ...,  an (1 ≤ ai ≤ 109).
900
Print a single integer — the length of the maximum non-decreasing subsegment of sequence a.
standard output
PASSED
e0c597021074414d1e73b80c0b9930af
train_000.jsonl
1442939400
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
256 megabytes
import java.util.*; public class subSequence { public static void main(String []args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int arr[] = new int[n]; for(int i=0; i<n; i++) arr[i] = s.nextInt(); int ans = segment(arr); System.out.println(ans); } static int segment(int arr[]) {...
Java
["6\n2 2 1 3 4 1", "3\n2 2 9"]
2 seconds
["3", "3"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
Java 7
standard input
[ "dp", "implementation", "brute force" ]
1312b680d43febdc7898ffb0753a9950
The first line contains integer n (1 ≤ n ≤ 105). The second line contains n integers a1,  a2,  ...,  an (1 ≤ ai ≤ 109).
900
Print a single integer — the length of the maximum non-decreasing subsegment of sequence a.
standard output
PASSED
5dc1c8c6b84bc4277122264ff2779da3
train_000.jsonl
1442939400
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
256 megabytes
import java.util.Scanner; public class Codeforces { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] a = new int[100005]; int[] b = new int[100005]; int n = sc.nextInt(); a[0]=sc.nextInt(); b[0]=1; int ans=1; for(in...
Java
["6\n2 2 1 3 4 1", "3\n2 2 9"]
2 seconds
["3", "3"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
Java 7
standard input
[ "dp", "implementation", "brute force" ]
1312b680d43febdc7898ffb0753a9950
The first line contains integer n (1 ≤ n ≤ 105). The second line contains n integers a1,  a2,  ...,  an (1 ≤ ai ≤ 109).
900
Print a single integer — the length of the maximum non-decreasing subsegment of sequence a.
standard output
PASSED
1c9d34d0542395811a7af2e773df0122
train_000.jsonl
1442939400
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
256 megabytes
import java.util.*; public class Problem580A { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int runtime = scanner.nextInt(); int [] input = new int[runtime]; int realresult = 1; int newresult = 1; for(int i = 0; i < runtime; i++) { input[i] = scanner.nextInt(); ...
Java
["6\n2 2 1 3 4 1", "3\n2 2 9"]
2 seconds
["3", "3"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
Java 7
standard input
[ "dp", "implementation", "brute force" ]
1312b680d43febdc7898ffb0753a9950
The first line contains integer n (1 ≤ n ≤ 105). The second line contains n integers a1,  a2,  ...,  an (1 ≤ ai ≤ 109).
900
Print a single integer — the length of the maximum non-decreasing subsegment of sequence a.
standard output
PASSED
b811577d23278340ea415c44bf668f7b
train_000.jsonl
1442939400
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
256 megabytes
import java.util.*; public class kefa_and_first_steps { public static void main( String[] args ) { Scanner in = new Scanner( System.in ); int n = in.nextInt(), a = in.nextInt(), c = 1, m = Integer.MIN_VALUE; for ( int i = 1; i < n; i++ ) { int b = in.nextInt(); ...
Java
["6\n2 2 1 3 4 1", "3\n2 2 9"]
2 seconds
["3", "3"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
Java 7
standard input
[ "dp", "implementation", "brute force" ]
1312b680d43febdc7898ffb0753a9950
The first line contains integer n (1 ≤ n ≤ 105). The second line contains n integers a1,  a2,  ...,  an (1 ≤ ai ≤ 109).
900
Print a single integer — the length of the maximum non-decreasing subsegment of sequence a.
standard output
PASSED
77eadbbad0654b799f53730a5f5219e7
train_000.jsonl
1442939400
Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 ≤ i ≤ n) he makes ai money. Kefa loves progress, that's why he wants to know the length of the maximum non-decreasing subsegment in sequence ai. Let us remind you that the subsegment of the sequence is it...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Ideone { public static void main (String[] args) throws java.lang.Exception { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] arr = new int[n]; ...
Java
["6\n2 2 1 3 4 1", "3\n2 2 9"]
2 seconds
["3", "3"]
NoteIn the first test the maximum non-decreasing subsegment is the numbers from the third to the fifth one.In the second test the maximum non-decreasing subsegment is the numbers from the first to the third one.
Java 7
standard input
[ "dp", "implementation", "brute force" ]
1312b680d43febdc7898ffb0753a9950
The first line contains integer n (1 ≤ n ≤ 105). The second line contains n integers a1,  a2,  ...,  an (1 ≤ ai ≤ 109).
900
Print a single integer — the length of the maximum non-decreasing subsegment of sequence a.
standard output
PASSED
488e0f1ef2f2112d9b6cda022f75888f
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
//package March16; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
5a0a2edc1f5c5bf662d3205b46f6a940
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
// Don't place your source in a package import java.util.*; import java.lang.*; import java.io.*; // Please name your class Main public class Main { public static void main (String[] args) { Scanner in = new Scanner(System.in); HashSet<String> hs = new HashSet<String>(); int n = in.nextInt(), count =...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
e021da2ab5eb04a013d7719e16ce7783
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.HashMap; import java.util.Arrays; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(Syste...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
5f5341141ef74c01648c85238afe9e0a
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.Arrays; import java.util.Scanner; import java.util.*; // http://codeforces.com/problemset/problem/975/A public class aramic{ public static void main(String...args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); HashSet<String> wordSet = new HashSet<>(); for( int i = 0;i<n;...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
10aa19d7d326745dfb1619f828e633a0
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.HashSet; import java.util.Scanner; public class Driver { public static Scanner scanner; public static void main(String[] args) { scanner = new Scanner(System.in); int n = scanner.nextInt(); String[] st = new String[n]; for(int i=0; i<n; i++) st[i] = scanner.next(); HashSet<HashSet<C...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
c19d38d587f9f4c63a7993c574b41f57
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.*; public class AramicScript { public static void main(String [] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); Set<Set<Character>> answer = new HashSet<>(); for(int i = 0; i < n; i++){ String string = input.next(); ...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
df56f634db4bf600692685b669366b86
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.HashSet; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is a...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
12506ba7786083fb1a5995d9ef853187
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.*; public class abc { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); String[]table = new String[n]; Set<String> list = new HashSet<>(); String res = ""; for (int i = 0; i <n; i++) { ...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
ea67595d0693717469e3508ad63bc58b
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; /** * * @author moham */ public class NewMain17 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
dc548af63b342f1344f35a192d0be019
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.regex.Pattern; import javafx.scene.shape.Line; public class Main{ private static InputStream stream; private static byte[] buf ...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
40f538cbbcb5f5f3e785e607fcc6c3d3
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$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.HashMap; import java.util.HashSet; import java.util.Map; import java.util.StringTokenizer; import java.util.TreeMap; public class A { static String remov...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
b43d451fbf22a02baa7e4ff17d076cdf
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class B { public static void main(String args[]) throws IOException { Scanner sc=new Scanner (Syst...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
fe5eb151f51cf026a7d786cf058e3de0
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.*; import java.io.*; // Main public class Main { public static void main (String[] argv) { new Main(); } public Main() { FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in))); //FastReader in = new FastReader(new BufferedReader(new FileReade...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
58e6d3fb9f1e9120ef83d65964fef972
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.*; import java.io.*; // Main public class Main { public static void main (String[] argv) { new Main(); } public Main() { FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in))); //FastReader in = new FastReader(new BufferedReader(new FileReader...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
731d20679e74b6aaee9bd08593cdbf7c
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class A_GENERAL { public static void main(String[] args) { MyScanner sc = new MyScanner(); int n = sc.nextInt(); Set<Character> charset; Set<String> final...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
fa619c79e981d758fe6fcf3c544b25bd
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; import java.util.TreeSet; @SuppressWarnings("unused") public class B { public static Scanner scan = new Scanner(System.in); public static void solve () { int n=scan.nextInt(); String[] s= new String[n]; for(int i=0;i<n;i++) { s[i]=scan.next(); ...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
828e315a554f2700ea9999091a2fb50a
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Reader.init(System.in); int n = Reader.nextInt() ; str ar[] = new str[n] ; for(int i = 0 ; i < n ; i++) { ar[i] = new str(...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
92df6815042906a685ea8ca1ac3bc0c7
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.*; public class one{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int n=Integer.parseInt(sc.nextLine()); String[] s=sc.nextLine().split(" "); Set<Set> set=new HashSet<Set>(); for(int i=0;i<n;i++){ Set<Character> s1=new HashSet<Character>(); for(int j=0;j<s...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
4eaaf0799349ad522080cce45ab447ae
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.InputMismatchException; public class A975 { private static int MAX = 50; public static void main(String[] args) throws Exception { Prin...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
775b6da247a0715f66b850bdc8b6eecf
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class cp { public static void main(String args[]) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(S...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
7feaedbd8aa1b05160feb98ac630c9ce
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$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.HashSet; import java.util.StringTokenizer; public class temp { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(S...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
248532cddab331f8548d42ad5696eedf
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.*; import java.util.Scanner; public class index { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int n = cin.nextInt(); Set<Set> s = new HashSet<>(); for (int i = 0; i < n; i++) { String script = cin.next(); ...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
d49ee96a0b402ac25b12455d4d96b62e
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
//package DC; //new import java.awt.List; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Scanner; import javax.print.attribute.Size2DSyntax;; public class Main { public static void main(String[] args) { HashMap<String, ArrayList<...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
b226eeb05fc9b04d89c4676a18b14164
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.math.BigInteger; import java.util.*; import java.io.*; public class A{ public static void main(String arg[]) { FastScanner sc = new FastScanner(System.in); int n ,c=0; n = sc.nextInt(); String sums [] = new String[n]; ArrayList<String>list = new ArrayList<>(); ...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
d7a82f215287aa30bb107856bffe5e94
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class forces{ public static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } ...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
ba330f52d49cf14be80fcfa4c9f68e57
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.*; import java.lang.*; import java.text.DecimalFormat; import java.text.NumberFormat; import java.io.*; public class Solution { static PrintWriter out; static class FastReader { BufferedReader br; StringTokenizer st; public Fast...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
922e9921281a74ff07752f7d971a47fb
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.io.ByteArrayInputStream; import java.util.Scanner; public class Main2 { // 5 // a aa aa ab abb public static void main(String[] args) { String input = ""; ByteArrayInputStream bais = new ByteArrayInputStream(input.getBytes()); Scanner scanner = new Scanner(System.in); ...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
c3e5edcd40bb5f208cac449cc699179c
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.io.*; import java.math.*; import java.util.StringTokenizer; public class Aramic { static PrintStream out = System.out; public static void main(String args[] ) throws Exception { ...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
0c0e17710ce30ef185a1edd7c0bcb325
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
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.HashSet; import java.util.Scanner; import java.util.Set; /** * * @author SNEHITH */ public class problem_A { ...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
e0546dcd00b791c421d487946b961732
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
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.HashSet; import java.util.Scanner; import java.util.Set; /** * * @author SNEHITH */ public class problem_A { ...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
646cfb2173d11a25b99e44bbf5ef0529
train_000.jsonl
1525183500
In Aramic language words can only represent objects.Words in Aramic have special properties: A word is a root if it does not contain the same letter more than once. A root and all its permutations represent the same object. The root $$$x$$$ of a word $$$y$$$ is the word that contains all letters that appear in $$$y...
256 megabytes
import java.util.*; public class prob1 { public static void main (String[] args) throws java.lang.Exception { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); String[] a = new String[n]; for(int i=0;i<n;i++){ a[i] = scan.next(); } for(int i=0;i<n-1;i++){ if(a[i]!=null){ int[]...
Java
["5\na aa aaa ab abb", "3\namer arem mrea"]
1 second
["2", "1"]
NoteIn the first test, there are two objects mentioned. The roots that represent them are "a","ab".In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Java 8
standard input
[ "implementation", "strings" ]
cf1eb164c4c970fd398ef9e98b4c07b1
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 10^3$$$) — the number of words in the script. The second line contains $$$n$$$ words $$$s_1, s_2, \ldots, s_n$$$ — the script itself. The length of each string does not exceed $$$10^3$$$. It is guaranteed that all characters of the strings are small latin le...
900
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
standard output
PASSED
0253bbec7b8737d9bc00ab897c08381d
train_000.jsonl
1569143100
Marcin is a coach in his university. There are $$$n$$$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.Let's focus on the students. They are indexed with integers from $$$1$$$ to $$$n$$$. Each of them can be described with ...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchException; import java.util.Map; import java.util.NoSuchElementException; public class Main { stat...
Java
["4\n3 2 3 6\n2 8 5 10", "3\n1 2 3\n1 2 3", "1\n0\n1"]
3 seconds
["15", "0", "0"]
NoteIn the first sample test, it's optimal to send the first, the second and the third student to the camp. It's also possible to send only the first and the third student, but they'd have a lower sum of $$$b_i$$$.In the second test, in each group of at least two students someone will always think that he is better tha...
Java 8
standard input
[ "dfs and similar", "greedy", "graphs", "brute force" ]
9404ec14922a69082f3573bbaf78ccf0
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 7000$$$) — the number of students interested in the camp. The second line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$a_i$$$ ($$$0 \leq a_i &lt; 2^{60}$$$). The third line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$b_i$$$ ($$$1 \leq ...
1,700
Output one integer which denotes the maximum sum of $$$b_i$$$ over the students in a group of students which can work together calmly. If no group of at least two students can work together calmly, print 0.
standard output
PASSED
91eb1edc7247a0eaf92ca88b0b21310c
train_000.jsonl
1569143100
Marcin is a coach in his university. There are $$$n$$$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.Let's focus on the students. They are indexed with integers from $$$1$$$ to $$$n$$$. Each of them can be described with ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.StringTokenizer; /* * To change this license header, choose License Headers in Project Properties. * To change this template...
Java
["4\n3 2 3 6\n2 8 5 10", "3\n1 2 3\n1 2 3", "1\n0\n1"]
3 seconds
["15", "0", "0"]
NoteIn the first sample test, it's optimal to send the first, the second and the third student to the camp. It's also possible to send only the first and the third student, but they'd have a lower sum of $$$b_i$$$.In the second test, in each group of at least two students someone will always think that he is better tha...
Java 8
standard input
[ "dfs and similar", "greedy", "graphs", "brute force" ]
9404ec14922a69082f3573bbaf78ccf0
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 7000$$$) — the number of students interested in the camp. The second line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$a_i$$$ ($$$0 \leq a_i &lt; 2^{60}$$$). The third line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$b_i$$$ ($$$1 \leq ...
1,700
Output one integer which denotes the maximum sum of $$$b_i$$$ over the students in a group of students which can work together calmly. If no group of at least two students can work together calmly, print 0.
standard output
PASSED
334c60907748e9dee6e5714c2bfbe49b
train_000.jsonl
1569143100
Marcin is a coach in his university. There are $$$n$$$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.Let's focus on the students. They are indexed with integers from $$$1$$$ to $$$n$$$. Each of them can be described with ...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(in.readLine()); long[] a = new long[n]; long[] b = new long[n]; ...
Java
["4\n3 2 3 6\n2 8 5 10", "3\n1 2 3\n1 2 3", "1\n0\n1"]
3 seconds
["15", "0", "0"]
NoteIn the first sample test, it's optimal to send the first, the second and the third student to the camp. It's also possible to send only the first and the third student, but they'd have a lower sum of $$$b_i$$$.In the second test, in each group of at least two students someone will always think that he is better tha...
Java 8
standard input
[ "dfs and similar", "greedy", "graphs", "brute force" ]
9404ec14922a69082f3573bbaf78ccf0
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 7000$$$) — the number of students interested in the camp. The second line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$a_i$$$ ($$$0 \leq a_i &lt; 2^{60}$$$). The third line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$b_i$$$ ($$$1 \leq ...
1,700
Output one integer which denotes the maximum sum of $$$b_i$$$ over the students in a group of students which can work together calmly. If no group of at least two students can work together calmly, print 0.
standard output
PASSED
d0bbfc0a43ceb0c6495cc022e6326ac5
train_000.jsonl
1569143100
Marcin is a coach in his university. There are $$$n$$$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.Let's focus on the students. They are indexed with integers from $$$1$$$ to $$$n$$$. Each of them can be described with ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.util.TreeSet; /** * Created by mostafa on 10/6/19. */ public class CF588D { public static void main(String[] args) throws I...
Java
["4\n3 2 3 6\n2 8 5 10", "3\n1 2 3\n1 2 3", "1\n0\n1"]
3 seconds
["15", "0", "0"]
NoteIn the first sample test, it's optimal to send the first, the second and the third student to the camp. It's also possible to send only the first and the third student, but they'd have a lower sum of $$$b_i$$$.In the second test, in each group of at least two students someone will always think that he is better tha...
Java 8
standard input
[ "dfs and similar", "greedy", "graphs", "brute force" ]
9404ec14922a69082f3573bbaf78ccf0
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 7000$$$) — the number of students interested in the camp. The second line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$a_i$$$ ($$$0 \leq a_i &lt; 2^{60}$$$). The third line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$b_i$$$ ($$$1 \leq ...
1,700
Output one integer which denotes the maximum sum of $$$b_i$$$ over the students in a group of students which can work together calmly. If no group of at least two students can work together calmly, print 0.
standard output
PASSED
90491e2d3604ec3b96be4f2a3120541b
train_000.jsonl
1569143100
Marcin is a coach in his university. There are $$$n$$$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.Let's focus on the students. They are indexed with integers from $$$1$$$ to $$$n$$$. Each of them can be described with ...
256 megabytes
import java.io.*; import java.util.*; public class TaskD { static class X { long bit, sum; int cnt; X(long bit, long sum, int cnt) { this.bit = bit; this.sum = sum; this.cnt = cnt; } } public static void main(String[] args) { Fa...
Java
["4\n3 2 3 6\n2 8 5 10", "3\n1 2 3\n1 2 3", "1\n0\n1"]
3 seconds
["15", "0", "0"]
NoteIn the first sample test, it's optimal to send the first, the second and the third student to the camp. It's also possible to send only the first and the third student, but they'd have a lower sum of $$$b_i$$$.In the second test, in each group of at least two students someone will always think that he is better tha...
Java 8
standard input
[ "dfs and similar", "greedy", "graphs", "brute force" ]
9404ec14922a69082f3573bbaf78ccf0
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 7000$$$) — the number of students interested in the camp. The second line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$a_i$$$ ($$$0 \leq a_i &lt; 2^{60}$$$). The third line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$b_i$$$ ($$$1 \leq ...
1,700
Output one integer which denotes the maximum sum of $$$b_i$$$ over the students in a group of students which can work together calmly. If no group of at least two students can work together calmly, print 0.
standard output
PASSED
4c94f31bd48f5e0b5e9d7204b1c928b5
train_000.jsonl
1569143100
Marcin is a coach in his university. There are $$$n$$$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.Let's focus on the students. They are indexed with integers from $$$1$$$ to $$$n$$$. Each of them can be described with ...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class D { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine().trim()); HashMap<L...
Java
["4\n3 2 3 6\n2 8 5 10", "3\n1 2 3\n1 2 3", "1\n0\n1"]
3 seconds
["15", "0", "0"]
NoteIn the first sample test, it's optimal to send the first, the second and the third student to the camp. It's also possible to send only the first and the third student, but they'd have a lower sum of $$$b_i$$$.In the second test, in each group of at least two students someone will always think that he is better tha...
Java 8
standard input
[ "dfs and similar", "greedy", "graphs", "brute force" ]
9404ec14922a69082f3573bbaf78ccf0
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 7000$$$) — the number of students interested in the camp. The second line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$a_i$$$ ($$$0 \leq a_i &lt; 2^{60}$$$). The third line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$b_i$$$ ($$$1 \leq ...
1,700
Output one integer which denotes the maximum sum of $$$b_i$$$ over the students in a group of students which can work together calmly. If no group of at least two students can work together calmly, print 0.
standard output
PASSED
e070ccfdad3bf4d8e2afabb0a51dcbe9
train_000.jsonl
1569143100
Marcin is a coach in his university. There are $$$n$$$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.Let's focus on the students. They are indexed with integers from $$$1$$$ to $$$n$$$. Each of them can be described with ...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader in = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); static int oo = (int)1e9; static int mod = 1_000_000_007; static int[] di = {-1, 1, 0, 0}; static int[] dj = {0, 0, -1, 1}; public st...
Java
["4\n3 2 3 6\n2 8 5 10", "3\n1 2 3\n1 2 3", "1\n0\n1"]
3 seconds
["15", "0", "0"]
NoteIn the first sample test, it's optimal to send the first, the second and the third student to the camp. It's also possible to send only the first and the third student, but they'd have a lower sum of $$$b_i$$$.In the second test, in each group of at least two students someone will always think that he is better tha...
Java 8
standard input
[ "dfs and similar", "greedy", "graphs", "brute force" ]
9404ec14922a69082f3573bbaf78ccf0
The first line contains one integer $$$n$$$ ($$$1 \leq n \leq 7000$$$) — the number of students interested in the camp. The second line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$a_i$$$ ($$$0 \leq a_i &lt; 2^{60}$$$). The third line contains $$$n$$$ integers. The $$$i$$$-th of them is $$$b_i$$$ ($$$1 \leq ...
1,700
Output one integer which denotes the maximum sum of $$$b_i$$$ over the students in a group of students which can work together calmly. If no group of at least two students can work together calmly, print 0.
standard output
PASSED
d5e5b75f68fd0245110629b6bb4e91aa
train_000.jsonl
1517582100
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri...
256 megabytes
/* Author: Ronak Agarwal, reader part not written by me*/ import java.io.* ; import java.util.* ; import static java.lang.Math.min ; import static java.lang.Math.max ; import static java.lang.Math.abs ; import static java.lang.Math.log ; import static java.lang.Math.pow ; import static java.lang.Math.sqrt ; /* Thread i...
Java
["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"]
2 seconds
["30\n13\n4\n22"]
null
Java 8
standard input
[ "data structures", "dsu", "number theory", "brute force" ]
078cdef32cb5e60dc66c66cae3d4a57a
The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-...
2,000
For each SUM query print the answer to it.
standard output
PASSED
323f66ed603be019cdd5169618bc33d1
train_000.jsonl
1517582100
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri...
256 megabytes
/* Author: Ronak Agarwal, reader part not written by me*/ import java.io.* ; import java.util.* ; import static java.lang.Math.min ; import static java.lang.Math.max ; import static java.lang.Math.abs ; import static java.lang.Math.log ; import static java.lang.Math.pow ; import static java.lang.Math.sqrt ; /* Thread i...
Java
["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"]
2 seconds
["30\n13\n4\n22"]
null
Java 8
standard input
[ "data structures", "dsu", "number theory", "brute force" ]
078cdef32cb5e60dc66c66cae3d4a57a
The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-...
2,000
For each SUM query print the answer to it.
standard output
PASSED
8b0ab02420540b1ae469dcbcf24dec7b
train_000.jsonl
1517582100
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Objects; import java.util.StringTokenizer; public final class ProblemF { public static void main(String[] args) throws IOException { final FastIn in = FastIn.fromSystemIn(); final int n = in.nextInt(); final int m = in.nextInt(); ...
Java
["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"]
2 seconds
["30\n13\n4\n22"]
null
Java 8
standard input
[ "data structures", "dsu", "number theory", "brute force" ]
078cdef32cb5e60dc66c66cae3d4a57a
The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-...
2,000
For each SUM query print the answer to it.
standard output
PASSED
7bd5be4887ad746714d07f75493f816e
train_000.jsonl
1517582100
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.util.HashMap; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper p...
Java
["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"]
2 seconds
["30\n13\n4\n22"]
null
Java 8
standard input
[ "data structures", "dsu", "number theory", "brute force" ]
078cdef32cb5e60dc66c66cae3d4a57a
The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-...
2,000
For each SUM query print the answer to it.
standard output
PASSED
f51498ee97a86c3b25c1c83804410d9c
train_000.jsonl
1517582100
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri...
256 megabytes
import java.util.*; import java.io.*; public class MainClass { static int[] div; public static void main(String[] args) throws IOException { Reader in = new Reader(); int n = in.nextInt(); int m = in.nextInt(); div = new int[1000000 + 5]; Arrays.fill(div, 1); ...
Java
["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"]
2 seconds
["30\n13\n4\n22"]
null
Java 8
standard input
[ "data structures", "dsu", "number theory", "brute force" ]
078cdef32cb5e60dc66c66cae3d4a57a
The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-...
2,000
For each SUM query print the answer to it.
standard output
PASSED
b11676918bf84360f1ed06c7520e863b
train_000.jsonl
1517582100
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri...
256 megabytes
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Bit...
Java
["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"]
2 seconds
["30\n13\n4\n22"]
null
Java 8
standard input
[ "data structures", "dsu", "number theory", "brute force" ]
078cdef32cb5e60dc66c66cae3d4a57a
The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-...
2,000
For each SUM query print the answer to it.
standard output
PASSED
5e653a95532abad5d2e784cd2342fdd2
train_000.jsonl
1517582100
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri...
256 megabytes
/* * Author: Minho Kim (ISKU) * Date: February 02, 2018 * E-mail: minho.kim093@gmail.com * * https://github.com/ISKU/Algorithm * http://codeforces.com/problemset/problem/920/F */ import java.util.*; import java.io.*; public class F { private static int[] divisor; private static long[] tree; private static ...
Java
["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"]
2 seconds
["30\n13\n4\n22"]
null
Java 8
standard input
[ "data structures", "dsu", "number theory", "brute force" ]
078cdef32cb5e60dc66c66cae3d4a57a
The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-...
2,000
For each SUM query print the answer to it.
standard output
PASSED
8c2be2a17b2d92337ca9df0a66d6d85c
train_000.jsonl
1517582100
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri...
256 megabytes
import java.util.*; import java.io.*; public class SUMandREPLACE { /************************ SOLUTION STARTS HERE ************************/ static int tau[]; static final int MAX = (int) 1e6; static { tau = new int[MAX + 1]; for(int i = 1; i <= MAX; i++) ...
Java
["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"]
2 seconds
["30\n13\n4\n22"]
null
Java 8
standard input
[ "data structures", "dsu", "number theory", "brute force" ]
078cdef32cb5e60dc66c66cae3d4a57a
The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-...
2,000
For each SUM query print the answer to it.
standard output
PASSED
1b0907f58c06dbfe39ea6ddaa5c85c28
train_000.jsonl
1517582100
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri...
256 megabytes
import java.awt.List; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java....
Java
["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"]
2 seconds
["30\n13\n4\n22"]
null
Java 8
standard input
[ "data structures", "dsu", "number theory", "brute force" ]
078cdef32cb5e60dc66c66cae3d4a57a
The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-...
2,000
For each SUM query print the answer to it.
standard output
PASSED
5cc4f6eef186da6d44047244cc8ac18c
train_000.jsonl
1517582100
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 2, 3 and 6).You are given an array a of n integers. You have to process two types of queries: REPLACE l r — for every replace ai with D(ai); SUM l r — calculate . Pri...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.math.*; import java.text.DecimalFormat; import java.util.*; public class Main { private static final int MAX = 1000*1000,MAXP2 = 1 << 19,MAXST = MAXP2 << 1; private static int n,m; private static int [] A; private static int [] sig0; ...
Java
["7 6\n6 4 1 10 3 2 4\n2 1 7\n2 4 5\n1 3 5\n2 4 4\n1 5 7\n2 1 7"]
2 seconds
["30\n13\n4\n22"]
null
Java 8
standard input
[ "data structures", "dsu", "number theory", "brute force" ]
078cdef32cb5e60dc66c66cae3d4a57a
The first line contains two integers n and m (1 ≤ n, m ≤ 3·105) — the number of elements in the array and the number of queries to process, respectively. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 106) — the elements of the array. Then m lines follow, each containing 3 integers ti, li, ri denoting i-...
2,000
For each SUM query print the answer to it.
standard output