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
6f75c58e3591a86f99ee5ed8a8fae1c7
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import static java.lang.Double.parseDouble; import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Math.max; import s...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 11
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
2e1e9e07b45a2989a9433beca4cd4566
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class q4 { public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // public static long mod = 1000000007; public static int[] rank,par; public static int find(int a){ if(par[a] == a) return a; pa...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 11
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
58d8e3450580af7bca80e9bd78e7bc52
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; public class Deltix { public static void main(String[] args) { MyScanner sc = new MyScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int t = 1; while (t-- > 0) { int n = sc.nextInt(); ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 11
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
1b61a493ab736b172cefb020acdf1f58
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args){ InputStream inputStream = System.in; Outp...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 11
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
87b135a3364d318b04e312a86e67b338
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.FileReader;...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 11
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
12f64070bf84d4aa562af52792426514
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class CF1609D extends PrintWriter { CF1609D() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1609D o = new CF1609D(); o.main(); o.flush(); } int[] ds; int find(int i) { return ds[i] < 0 ? i : (ds[i] = find(ds[i...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 11
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
a046111c3e1e66544f7cbe9040ea45ca
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; public class D { public static final int MOD998 = 998244353; public static final int MOD100 = 1000000007; public static void main(String[] args) throws Exception { ContestScanner sc = new ContestScanner(); ContestPrinter cp = new ContestPrinter(); int N = sc.ne...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 11
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
bbfce0a8fa2d529b8ba0dbb6b61a2ed6
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; public class D_1609 { static TreeMap<Integer, Integer> map; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(), d = sc.nextInt(); int[] x = new ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 11
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
6491aa7076c4185a08ba0f1954be26e0
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; public class D { int get(int v, int[] p) { return p[v] == v ? v : (p[v] = get(p[v], p)); } void submit() { int n = nextInt(); int d = nextInt(); int[] p = new int[n]; int[] sz = new int[n]; for (int i...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 11
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
0c2fb2a0c69938245b18b9c2c35762b9
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.math.BigInteger; import java.util.*; import java.io.*; public class Balabizo { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt() , m = sc.nextInt(); ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
6a9f4a2157d96f0cb2b7c51f3c537378
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main2 { static Scanner sc; static PrintWriter pw; public static void main(String[] args) throws Exception { pw = new PrintWriter(System.out); sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(); int[][] arr =...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
1639078540a3c6976873c07295524d1d
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
//package codeforce.div2.deltix.Autumn2021; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Collections; ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
afc8eb540ddff1bc1d85bae1bd50573c
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
//package codeforce.div2.deltix.Autumn2021; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Collections; ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
360518ee7e7b247c4b2b22ba489acc0a
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
//package codeforce.div2.deltix.Autumn2021; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Collections; ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
f90ec43cfe8d1b0b866e680ea9350f3d
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
//package codeforce.div2.deltix.Autumn2021; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Collections; ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
d2a7d2edc92d6081434ba3dc7339c16f
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; //1600: 18:22 public class social_network { static int[] root; public static void main(String[] args)throws IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter out = new Buff...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
4a6dba5062eebbff9bfcda31656e625b
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; public class s2 { public static void main(String[] args) throws Exception { FastScanner scan=new FastScanner(System.in); PrintWriter out=new PrintWriter(System.out); int T=1; // int T=scan.nextInt(); while(T-->0) { int n=scan.nextInt(); int d=scan.next...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
46b1a174ccac75bb28128e882235bc40
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; public class D1609{ static int ans = 0; static FastScanner fs = null; public static void main(String[] args) { fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int n = fs.nextInt(); int d = fs.nextInt(); int sz[] = new int[n+1]; int p...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
b0981f52c48e144a4162c2fa2c4b2ca8
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.math.BigInteger; public final class A { static PrintWriter out = new PrintWriter(System.out); static StringBuilder ans=new StringBuilder(); static FastReader in=new FastReader(); static ArrayList<Integer> g[]; static l...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
ca8a774aecdf773d4ac41438bf1df833
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; public class Main { public static void main(Stri...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
b083b2c28f5866b343db2fb648c002f9
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; public class Main { public static void main(Stri...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
2f3d7f94065711a5900a3df40c691d3e
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class A { //--------------------------INPUT READER---------------------------------// static class fs { public BufferedReader br; StringTokenizer st = new StringTokenizer(""); public fs() { this(System.in); } public fs(Inpu...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
4dc346b5ffd0756c1fba290001258446
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
/*========================================================================== * AUTHOR: RonWonWon * CREATED: 01.12.2021 14:44:14 /*==========================================================================*/ import java.io.*; import java.util.*; public class D { public static void main(St...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
791f399c1d2113c09479e5002e10aca7
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.beans.DesignMode; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.CompletableFuture.Asyn...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
ffdd67eaa8c4dcf2f3f50a77dbc549fb
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
//package codeforces.deltix_autumn; import java.io.*; import java.util.*; import static java.lang.Math.*; //Think through the entire logic before jump into coding! //If you are out of ideas, take a guess! It is better than doing nothing! //Read both C and D, it is possible that D is easier than C for you! //Be awar...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
7c237392f2b290372d6a69ab3ad90dee
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
/** * @author vivek * programming is thinking, not typing */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class D { private static void solveTC(int __) { /* For Google */ // ans.append("Case #").append(__).appe...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
936e67d2547512dcd0e4699205f7ca8d
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
/** * check out my youtube channel sh0rkyboy * https://tinyurl.com/zdxe2y4z * I do screencasts, solutions, and other fun stuff in the future */ import java.util.*; import java.io.*; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.Math.max; public class EdA { ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
92d91e8399dfb4a1ff931b444826c432
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class Main { //LinkedList implementation //all sets are stored static class DSU1{ int [] rep ; LinkedList<Integer>[]arr ; public DSU1(int n){ rep = new int[n]; arr = new LinkedList[n] ; for(int i=0 ; i <n ;i++){ arr[i] = new LinkedList<>() ; ar...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
bd16b709965c9e8218b18a6d8ec99640
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class Main { //LinkedList implementation //all sets are stored static class DSU1{ int [] rep ; LinkedList<Integer>[]arr ; public DSU1(int n){ rep = new int[n]; arr = new LinkedList[n] ; for(int i=0 ; i <n ;i++){ arr[i] = new Linked...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
a9965b98aa7966e7bb4d2f67aed44575
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
//package kg.my_algorithms.Codeforces; /* Control */ import java.util.*; import java.io.*; public class Solution { private static final FastReader fr = new FastReader(); public static void main(String[] args) throws IOException { BufferedWriter output = new BufferedWriter(new OutputS...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
e67cf2b8933ce0a2356ef2b459838029
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class SocialNetwork { public static void solve(FastIO io) { final int N = io.nextInt(); final int D = io.nextInt(); final int[] X = new int[D]; final int[] Y = new int[D]; for (int i = 0; i < D; ++i) { X[i] = io.nextInt(); Y[i] = io.nextInt(); ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
ecfcec4539e95ab8ea7d29c703eceff0
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static BufferedReader bf; static PrintWriter out; static Scanner sc; static StringTokenizer st; static long mod = (long)(1e9+7); static long mod2 = 998244353; static long fact[] = new long[1000001]; static long inverse[] = new long[1000001...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
01aa95643d41d185bd910fcebe9459a5
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class SocialNetwork{ static long mod = 1000000007L; static MyScanner sc = new MyScanner(); static class Dsu{ int parent[]; int n; Dsu(int n){ this.n = n; parent = new int[n]; for(int i = 0;i<n...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
f49f412a827169827e520818106f763d
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static Scanner sc = new Scanner(new BufferedInputStream(System.in)); static int sc(){return sc.nextInt();} static long scl(){return sc.nextLong();} static double scd(){return sc.nextDouble();}; static String scs(){return sc.next();}; ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
c47af13cc76627cb9ec31b62c6c29a5a
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; public class SocialNetwork { static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int n = scanner.nextInt(); int d = scanner.nextInt(); int[] set = new int[n]; TreeMap<Integer, Integer> tm = new TreeMap<>(); ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
bafe12ba6e7459fd4c3566882ea28107
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
//package com.company; import java.util.*; import java.io.*; public class SocialNetwork { static boolean[] gT; static int gC; static void dfsG(ArrayList<ArrayList<Integer>> connections, int node) { gT[node] = true; gC++; for(int i : connections.get(node)) { if(!gT[i]) { ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
98d673858df77ec9645fba3559261834
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class SocialNetwork { public static PrintWriter out; public static void main(String[] args)throws IOException{ Scanner sc=new Scanner(); out=new PrintWriter(System.out); int n=sc.nextInt(); int m=sc.nextInt(); DSU dsu=new DS...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
b237b1f111bcc8ee20e21b77ee9876b9
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
//package AdvancedDSLab; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
8987a60b307b8b948f9c48e163def08a
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class social_network { public static void main(String[] agrs) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(), D = sc.nextInt(); int extra = 0; ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
e0329e4ddb9c6c12a79c4f6ef46a0d68
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class social_network { public static void main(String[] agrs) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(), D = sc.nextInt(); int extra = 0; ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
c79b08fecf2532e6796923e1155b4419
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String args[]) { FastReader input=new FastReader(); PrintWriter out=new PrintWriter(System.out); int T=1; while(T-->0) { int n=input.nextInt(); int d=input...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
dbdf72e28c358ffe0d484ae04be2e344
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; public class ferrisWheel { static PrintWriter pw; static Scanner sc; public static void main(String[] args) throws IOException, InterruptedException { pw = new PrintWriter(System.out); sc = new Scanner(System.in); int n = sc.nextInt(); int q=sc.nextInt(); U...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
0a652338c873c44d2223232d3c843e96
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; public class Main { // For fast input output static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { try { br = new BufferedReader( new FileReader("input...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
c82e619e79faf3a0bcf225c12bf5d4e1
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static class DSU { private int[] parent; private int[] size; private int totalGroup; public DSU(int n) { parent = new int[n]; totalGroup = n; for (int i = 0; i < n; i++...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
017d9ae2d985366e3e09cee70070739f
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
/* * Everything is Hard * Before Easy * Jai Mata Dii */ import java.util.*; import java.io.*; public class Main { static class FastReader{ BufferedReader br;StringTokenizer st;public FastReader(){br = new BufferedReader(new InputStreamReader(System.in));}String next(){while (st == null || !st.h...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
dee328e1f5594ad732b62e61ea2692ac
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; public class Main { static FastScanner sc = new FastScanner(System.in); static PrintWriter pw = new PrintWriter(System.out); static StringBuilder sb = new StringBuilder(); static long mod = (long) 1e9 + 7; public static void main(String[] args) throws...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
33662ceb625c21ff8f0e0d1825a0829b
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
/* stream Butter! eggyHide eggyVengeance I need U xiao rerun when */ import static java.lang.Math.*; import java.util.*; import java.io.*; import java.math.*; public class x1609D { public static void main(String hi[]) throws Exception { BufferedReader infile = new BufferedReader(new Inp...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
d8bb69c366eea0463ef11560107c7731
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class SocialNetwork { static int find(int a, int[] par, int[] vis) { vis[a] = 1; if (par[a] < 0) { return a; } return par[a] = find(par[a], par, vis); } ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
e4362e97e89ab6d00b96d21ab2fdc710
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class a{ public static FastScanner fs; public static int n,d,rank[],sz[],p[]; public static void main(String args[]) { fs=new FastScanner(); n=fs.nextInt(); d=fs.nextInt(); rank=new int[n+1]; sz=new int[n+1];...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
517c049c53ea007ddcd95dc76dda990a
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.math.BigDecimal; import java.util.*; public class Main { private static final int ma = (int) 1e3 + 10; static int parent[] = new int[ma]; static int value[] = new int[ma]; static Integer a[] = new Integer[ma]; static int find(int x) { if (x != paren...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
4bb372cac830af90f949f1a7b5ea014b
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class new1{ public static boolean isConnected(ArrayList<ArrayList<Integer>> aList, int u, int p, int f) { if(u == f) return true; boolean ret = false; for(Integer x : aList.get(u)) { if(x != p) { ret = ret || isConnected(aList, x, u, f); } }...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
024f1bc11189808b1866e466b174b562
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /* Challenge 1: Newbie to CM in 1year (Dec 2021 - Nov 2022) 🔥 5* Codechef Challenge 2: CM to IM in 1 year (Dec 2022 - Nov 2023) 🔥🔥 6* Codechef Challenge 3: IM to GM in 1 year (Dec 2023 - Nov 2024) 🔥🔥🔥 7* Codechef Goal: Become better ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
6b5c1a714dfa51270b2f83189cfa6d3e
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /** * @author Naitik * */ public class Main { static FastReader sc=new FastReader(); static long dp[][][]; //static int v[][]; // static int mod=998244353;; static int mod=1000000007; static int max; static int bit[]; // ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
455b5ee76ac7a4e978aacb5143b90dc8
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class D { public static void main(String[] args) { //for (int t = IO.nextInt(), i = 0; i < t; i++) new SolD().solve(); IO.close(); } } class SolD { int n, d; int[] par, cnt; Map<Integer, Integer> hash; int e; SolD() { ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
7bf5a1846dd169e306f28d009504cc45
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; ////*************************************************************************** /* public class E_Gardener_and_Tree implements Runnable{ public static void main(String[] args) throws Exception { new Thread(null, new E_Gardener_and_Tree(), "E_Gardener_and_Tr...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
cc1e388fd742af60ad39c24848bbf6d9
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class social_network { public static void main(String[] agrs) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(), D = sc.nextInt(); int extra = 0; ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
aad6f2c0ebd7e0ff8953d8246a6bdb2e
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class D { public static void main(String[] hi) { FastIO io = new FastIO(); int n = io.nextInt(), q = io.nextInt(); DSU dsu = new DSU(n); int extra = 0; while (q --> 0) { int x = io.nextInt()-1, y = io.nextInt()-1; int a...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
968b838021fb1b34aca8712952bb7ff3
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long startTime = System.currentTimeMillis(); // for global initializations and methods starts here static class DSU { int[] rank, parent, node; int n, count, size; public DSU(int n) { rank...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
d40701bcfabc39b7c0936c367bf03572
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; public class D { static int find(int v, int[] parent) { if (parent[v] == v) { return v; } int res = find(parent[v], parent); parent[v] = res; return res; } static int getSizesSum(PriorityQueue<Integer> q, int count) { ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
2efd2205609bb6986f9c6b2202d08f36
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; import java.util.concurrent.ThreadLocalRandom; public class Main { public static void main(String[] args) throws FileNotFoundException { ConsoleIO io = new ConsoleIO(new InputStreamReader(System.in), new PrintWriter(System.out)); // String fileName = "C...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
9d3ff033966832271cec189b4a79b68d
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Collections; import java.util.PriorityQueue; import java.util.StringTokenizer; public class d { public static void main(String[] args) { FastScanner scan=new FastScanne...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
e644aa065bce74079eefc8b2bf9691b1
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public final class Main { static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)}; static int mod = (int) (1e9 + 7);...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
5e6a274e1d5052632e52341c6212bd52
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class D{ public static class dsu { int[] p; public dsu(int n) { p = new int[n]; for (int i = 0; i < n; i++) { p[i] = i; } } int find(int a) {return a == p[a] ? a: (p[a] = find(p[a]));} void merge(int a, i...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
0560bd848ff0099e5ff1ff61ad5a6d1f
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
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.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
18b427733c7f456670fc0883fd767c01
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*;import java.util.*;import java.math.*;import static java.lang.Math.*;import static java. util.Map.*;import static java.util.Arrays.*;import static java.util.Collections.*; import static java.lang.System.*; public class Main { public void tq()throws Exception { st=new Stri...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
e410346fdd86ec06f95a83d42a20aa82
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /** * @author Naitik * */ public class Main { static FastReader sc=new FastReader(); static long dp[][][]; //static int v[][]; // static int mod=998244353;; static int mod=1000000007; static int max; static int bit[]; // ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
42f3de4394dd26b4ab67e5998fc90881
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.util.InputMismatchException; import java.io.InputStreamReader; import java.io.Writer; import java.io.BufferedRead...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
bbc5b64cfc9834e5a923c273de0a9ee4
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; /* */ public class D{ static FastReader sc=null; public static void main(String[] args) { sc=new FastReader(); int n=sc.nextInt(),m=sc.nextInt(); DU du=new DU(n); int extra=0; for(int i=0;i<m;i++) { int v=sc.nextInt()-1,w=sc.nex...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
0412d27778f0a5ee80a1bd0403ea75ef
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static PrintWriter pr = new PrintWriter(System.out); static String readLine() throws IOException { return br.readLine(); } static Strin...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
d49bc398c85f8614ee7c3db042df0dde
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class D { public static void main(String[] args) throws IOException { /**/ Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in))); /*/ Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(new FileI...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
d8a36c8307b4b4443be3f0a9823c2879
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
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.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
4c607d35c9643209f827983f6d620277
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.io.*; import java.util.*; public class D { FastScanner in; PrintWriter out; boolean systemIO = true; public int sum(int x, int y) { if (x + y >= mod) { return x + y - mod; } return x + y; } public int diff(int x, int y) { if (x >= y) { return x - y; } return x -...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 8
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
8276613ecc226327e2130a26dc0fb6a6
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class RoundDeltixAutumn2021D { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final stati...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 17
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
194340a1604677c413079ed08f174229
train_110.jsonl
1638110100
William arrived at a conference dedicated to cryptocurrencies. Networking, meeting new people, and using friends' connections are essential to stay up to date with the latest news from the world of cryptocurrencies.The conference has $$$n$$$ participants, who are initially unfamiliar with each other. William can intr...
256 megabytes
import java.util.*; import java.io.*; public class A { static class Set{ int id; int count; Set parent; Set(int id){ this.id = id; this.count = 1; this.parent = this; } public void union(Set a, Set b){ ...
Java
["7 6\n1 2\n3 4\n2 4\n7 6\n6 5\n1 7", "10 8\n1 2\n2 3\n3 4\n1 4\n6 7\n8 9\n8 10\n1 4"]
2 seconds
["1\n1\n3\n3\n3\n6", "1\n2\n3\n4\n5\n5\n6\n8"]
NoteThe explanation for the first test case:In this explanation, the circles and the numbers in them denote a person with the corresponding number. The line denotes that William introduced two connected people. The person marked with red has the most acquaintances. These are not the only correct ways to introduce peopl...
Java 17
standard input
[ "dsu", "graphs", "greedy", "implementation", "trees" ]
29bc7a22baa3dc6bb508b00048e50114
The first line contains two integers $$$n$$$ and $$$d$$$ ($$$2 \le n \le 10^3, 1 \le d \le n - 1$$$), the number of people, and number of conditions, respectively. Each of the next $$$d$$$ lines each contain two integers $$$x_i$$$ and $$$y_i$$$ ($$$1 \le x_i, y_i \le n, x_i \neq y_i$$$), the numbers of people which mus...
1,600
Output $$$d$$$ integers. $$$i$$$th number must equal the number of acquaintances the person with the maximal possible acquaintances will have, if William performed $$$i$$$ introductions and satisfied the first $$$i$$$ conditions.
standard output
PASSED
c60340443961ebf8acc68f684760016a
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class RoundDeltixAutumn2021E { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final stati...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 17
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
50b779e70b4ba94d67cfa2b9af61e9dd
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
256 megabytes
// package c1609; import java.io.File; import java.lang.invoke.MethodHandles; import java.util.Arrays; import java.util.Random; import java.util.Scanner; // // Deltix Round, Autumn 2021 (open for everyone, rated, Div. 1 + Div. 2) 2021-11-28 06:35 // E. William The Oblivious // https://codeforces.com/contest/1609/prob...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 11
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
92daa903e718a55dbab29e747deb64a7
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.Arrays; import java.util.Random; import java.io.FileWriter; import java.io.PrintWriter; /* Solution Created: 12:02:09 01/12/2021 C...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 11
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
60ecf04b4616a6f5849d5df1b9d7d310
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
256 megabytes
// upsolve with kaiboy, coached by rainboy import java.io.*; import java.util.*; public class CF1609E extends PrintWriter { CF1609E() { super(System.out); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1609E o = new CF1609E(); o.main(); o.flush(); } static final int INF = 0x3f3f...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 11
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
e6c9702b52e841e40a1182e87ddd7f65
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; public class E { // This is an implementation of add to segment/set or add to point/query max on segment/query point. static class SegTree { Node root; int n; public SegTree(int n, int[] s) { Node.initS = s;...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 11
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
6a2149382706f3423142503469872fd9
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static void update(int[][][] stree, int node, int left, int right, int idx, char ch) { if (left == right) { for (int i=0; i<3; i++) { for (int j=i; j<3; j++) { stree[node][i][j] = 0; } } stree[node][ch-'a'][ch-...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 8
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
3e71cc7e7126e574c4e93121e89cb037
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static void update(int[][][] stree, int node, int left, int right, int idx, char ch) { if (left == right) { for (int i=0; i<3; i++) { for (int j=i; j<3; j++) { stree[node][i][j] = 0; } } if (ch == 'a') { s...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 8
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
6eb582aea4fe92cc3664148dde4e9f90
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static void update(int[][][] stree, int node, int left, int right, int idx, char ch) { if (left == right) { for (int i=0; i<3; i++) { for (int j=i; j<3; j++) { stree[node][i][j] = 0; } } if (ch == 'a') { s...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 8
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
f8e5773c4be9c048b314649f0a37fb47
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
256 megabytes
//package codeforce.practice; import org.w3c.dom.Node; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 8
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
a72eb3aacfa961e44b3b2f022b6a8d22
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
256 megabytes
//package codeforce.practice; import org.w3c.dom.Node; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 8
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
215bd17ec7c1e76105e6ae07a9053800
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
256 megabytes
/* stream Butter! eggyHide eggyVengeance I need U xiao rerun when */ import static java.lang.Math.*; import java.util.*; import java.io.*; import java.math.*; public class x1609E { static int N; public static void main(String hi[]) throws Exception { Node[] templates = new Node[3];...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 8
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
eea084c9cbe4d7bd2bbd1d57a547ca52
train_110.jsonl
1638110100
Before becoming a successful trader William got a university degree. During his education an interesting situation happened, after which William started to listen to homework assignments much more attentively. What follows is a formal description of the homework assignment as William heard it:You are given a string $...
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 e { public static void main(String[] args) { FastScanner scan=new FastScanner(); PrintWriter out=new PrintWrite...
Java
["9 12\naaabccccc\n4 a\n4 b\n2 b\n5 a\n1 b\n6 b\n5 c\n2 a\n1 a\n5 a\n6 b\n7 b"]
3 seconds
["0\n1\n2\n2\n1\n2\n1\n2\n2\n2\n2\n2"]
NoteLet's consider the state of the string after each query: $$$s = $$$"aaaaccccc". In this case the string does not contain "abc" as a subsequence and no replacements are needed. $$$s = $$$"aaabccccc". In this case 1 replacements can be performed to get, for instance, string $$$s = $$$"aaaaccccc". This string does n...
Java 8
standard input
[ "bitmasks", "data structures", "dp", "matrices" ]
b431e4af99eb78e2c6e53d5d08bb0bc4
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n, q \le 10^5)$$$, the length of the string and the number of queries, respectively. The second line contains the string $$$s$$$, consisting of characters "a", "b" and "c". Each of the next $$$q$$$ lines contains an integer $$$i$$$ and character $$$c$$$...
2,400
For each query output the minimal number of characters that would have to be replaced so that the string doesn't contain "abc" as a subsequence.
standard output
PASSED
8517a642b61eeae413e1ca0553a2b6e7
train_110.jsonl
1638110100
William has an array of non-negative numbers $$$a_1, a_2, \dots, a_n$$$. He wants you to find out how many segments $$$l \le r$$$ pass the check. The check is performed in the following manner: The minimum and maximum numbers are found on the segment of the array starting at $$$l$$$ and ending at $$$r$$$. The chec...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; import java.util.stream.*; public class F_fenwick { void submit() { int n = nextInt(); // int n = 1_000_000; long[] a = new long[n]; int[] b = new int[n]; boolean[] check = new boolean[62]; for (int i = 0; i < n; i++) { a[i] = next...
Java
["5\n1 2 3 4 5", "10\n0 5 7 3 9 10 1 6 13 7"]
2 seconds
["9", "18"]
null
Java 11
standard input
[ "data structures", "divide and conquer", "meet-in-the-middle", "two pointers" ]
026a7c78986c67593dbb4603da73e7df
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 10^6$$$), the size of array $$$a$$$. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^{18}$$$), the contents of array $$$a$$$.
2,800
Output a single number  — the total number of segments that passed the check.
standard output
PASSED
842bc3023514b18915dd6add3b281039
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int testcase = sc.nextInt(); for (int limit = 0; limit < testcase; limit++) { boolean flag = false; int n = sc.nextInt(); ...
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
facdffbc90c6adda76f220ea93277089
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
import java.util.*; @SuppressWarnings("unused") public class Main { private static void solve(int[] nums, int n) { for (int num : nums) { long d = (long) Math.sqrt(num); if (d * d != num) { System.out.println("YES"); return; } } System.out.println("NO"); ...
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
a3c2adb4968e21110e4b178a78f26ef1
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.PrintWriter; public class A_div2_716 { public static void main(String[] args) throws IOException { Reader scan = new Reader(); PrintWriter p = new PrintWriter(System.out); StringBuilder sb = new StringBuilder...
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
025a7af7f6867da677f304ef76715939
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int entries = Integer.parseInt(scan.nextLine()); for (int i = 0; i < entries; i++) { int ent = Integer.parseInt(scan....
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
5bc4cd57b2cdf49076ae34cdbd3252ca
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int entries = Integer.parseInt(scan.nextLine()); for (int i = 0; i < entries; i++) { int ent = Integer.parseInt(scan....
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
c87e81c4fd63c6dd929729e6b087290b
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
// HOPE //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //---------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////...
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
9f98949959e7e9ce619138a02a30ac2e
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
// HOPE //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //---------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////...
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
1a07765a2ddea51972ee8a47f61da4e0
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class TaskA { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(i...
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
372c185de43d6e1c84ecf28ff1409ab9
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new Input...
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
ca61f96c38b96c98afce5c571c8c207e
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); String[] res = new String[t]; for (int i = 0; i < t; i++) { int n = scan.nextInt(); boolean inperfec...
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
b93c1100becb393a48eab0fb181e4ddd
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
import java.util.Scanner; public class JavaApplication12 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); while(n--!=0){ boolean check=true; int r = in.nextInt(); int[]arr=new int[r]; ...
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
44becf97e696fb6b81359bd8f139628d
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class a { static long mod = 1000000007; public static void main(String[] args) throws Exception { FastScanner in = new FastScanner(); PrintWriter out = new PrintWriter(System.out...
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output
PASSED
8a0f2e4fb058b0318ef7148cce327d5e
train_110.jsonl
1618839300
Given an array $$$a$$$ of length $$$n$$$, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly zero) elements.
256 megabytes
import java.util.Scanner; public class PerfectlyImperfectArray { public static void main(String[] args) { Scanner scan=new Scanner(System.in); int t=scan.nextInt(); while(t-->0) { int n=scan.nextInt(); int flag=0; for(int i=0;i<n;i++) { int arr=scan.nextInt(); ...
Java
["2\n3\n1 5 4\n2\n100 10000"]
1 second
["YES\nNO"]
NoteIn the first example, the product of the whole array ($$$20$$$) isn't a perfect square.In the second example, all subsequences have a perfect square product.
Java 11
standard input
[ "math", "number theory" ]
33a31edb75c9b0cf3a49ba97ad677632
The first line contains an integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$. The second line of each test case contains $$$n$$$ integers $$...
800
If there's a subsequence of $$$a$$$ whose product isn't a perfect square, print "YES". Otherwise, print "NO".
standard output