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
ec6accf6e09b2b8f40525040720e4aa1
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main{ public static void main (String[] args){ FastReader s = new FastReader(); int t=1;//t=s.ni(); for(int test=1;test<=t;test++){ int n=s.ni(),q=s.ni(),cnt=0; String S=s.nextLine();char a[]=...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
499ad9960a15b1e3fd0a9ae0c805a6e2
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class deltix_21_a { public static void main(String args[]){ FScanner in = new FScanner(); PrintWriter out = new PrintWriter(System.out); //int t = in.nextInt(); //while(t-->0) { int n=in.nextInt(); int q=in.nextInt(); char ch[]=in...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
7c0b58ca6c2754c23ad968db29c0ba0b
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.Scanner; /** * * @author Acer */ public class WilliamAndVigilant { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int q = sc.nextInt(); String s = sc.next(); int count = 0; fo...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
13a03072397333ef9cfde604aeae8430
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import static java.lang.Math.*; import static java.lang.System.out; import java.util.*; import java.io.File; import java.io.PrintStream; import java.io.PrintWriter; import java.math.BigInteger; public class Main { ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
f58ad8f9c111a2ede34191432aedd27c
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.awt.Container; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class Main { public static bool...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
74a359bf855107d57e0562388623e316
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class B1609{ static FastScanner fs = null; public static void main(String[] args) { fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int n = fs.nextInt(); int q = fs.nextInt(); String s = fs.next(); char ch[] = s.toCharArray(); ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
35c8aaf3e646ec3e81577637af063b4f
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.awt.Container; import java.awt.image.SampleModel; 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.CountDownLatch; import javax.naming....
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
3a8a15cce53c7deed190fe58e4544097
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Deque; import java.util.HashMap; import java.util.H...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
a90b0c621b4b3ad8c80dc51e31dab10c
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // int t = Integer.parseInt(br.readLine()); int t = 1; while (t-- > 0) { ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
c257da605a1fbf6e7f287539e82b859b
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class WilliamtheVigilant { public static void main(String[] args) { // TODO Auto-generated method stub FastReader in=new FastReader(); int n = in.nextInt(); int q =...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
2f6a013739f242e1642cfa6062f266ef
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; //import javax.swing.plaf.basic.BasicInternalFrameTitlePane.SystemMenuBar; import java.lang.*; import java.io.*; public class Main { public static class FastReader { BufferedReader b; StringTokenizer s; public FastReader() { b=new BufferedReader(new InputStreamRea...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
29df3291fadc3f3ac96fd46fec3ce2e4
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; public class Solution { public static int count(char[] ch,char c,int pos,int n) { int temp1=0,temp2=0; for(int i=pos-2;i<pos+3;i++) { if(i>=0&&i<n) { if(ch[i]=='a') { if(i+1<n&&i+2<n&&ch[i+1]=='b'&&ch[i+2]=='c') temp1++; } } } ch[pos]=c; f...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
711e0165a0ef21deec22fbf04d1cb899
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
//package Div2.B; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class WilliamTheVigilant { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String []nq=br.read...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
226673e17455c08c4024d5f02273d6a3
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; public class Division { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int n = nextInt(); int a = nextInt(); String str = nextToken(); char[] chars = str.toCharArray(); int all = ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
7d3f942a4f9e935c4c3041e6ad950f15
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; import java.util.StringT...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
32f66ede03c97415f2063609ccb1da7e
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
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
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
ddb2a7f9b350ecf11c3fe44184c18806
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class Solution{ public static int f(char ch[],int pos,char c,int n) { int count = 0; if(ch[pos]=='a') { if(pos+1<n&&pos+2<n&&ch[pos+1]=='b'&&ch[pos+2]=='c') count++; } else if(ch[pos]=='b...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
2d2ddbf93d3131005cf8fbb7a835b64f
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class Main { static long startTime = System.currentTimeMillis(); // for global initializations and methods starts here // global initialisations and methods end here static void run() { boolean tc = false; // AdityaFastIO r =...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
9907e01676e7ac153661bab375ed9d51
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.util.stream.Collectors; import java.io.*; import java.math.*; public class B2 { public static FastScanner sc; public static PrintWriter pw; public static StringBuilder sb; public static int MOD= 1000000007; public static class FastScanner { BufferedReader b...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
d4057c427e70badc0a78dad27b479bb8
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.*; import java.util.*; /** * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
b3b7201078ab8bc64a32cac55faea0dc
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.Scanner; import java.util.Set; import java.util.TreeSet; public class A { static boolean isOkPos(int pos, char[] str) { return pos >= 0 && pos < str.length; } static boolean isAtABC(int pos, char[] str) { return isOkPos(pos, str) && isOkPos(pos + 1, str) && i...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
ca61267b57536329f44f7e78d65a198e
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
659b5d3099748bbe71cfb9502f07daf7
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { static boolean check (StringBuilder s , int i) { char ch = s.charAt(i); int n = s.length(); if (ch == 'a') { if (i == n - 2 || i == n - 1) { return false; } String sub = s.substring(i, i + 3); if (sub.eq...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
39ca70b5e07d95e348d6e42d2387ab21
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class Codechef{ static final int mod = (int)(1e9 + 7); static final FastReader sc = new FastReader(); static boolean forms_abc(int pos, char ch[]){ boolean res = true; if(ch[pos] == 'a'){ if(!(pos + 2 < ch.length && ch[pos+1] == 'b' && ch[pos+...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
595543ce50312e2e81e57d7a2e30582d
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
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
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
7b774842b11cfb88c901357422b9f6b2
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
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
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
96934714a2bba6986619b2633dc5c5d1
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Scanner; import java.util.StringTokenizer; public class B { static BufferedReader br; static StringTokenizer st; static PrintWriter pw; static String ne...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
28f96a1b2e37da01416700fee7c36fcc
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
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
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
9bd034f2359a7eb7b5df8174e7d51a6a
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
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
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
51abf977677c6dc3dc25fc84c7ee0091
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.io.*; public class s1 { public static FastScanner scan; public static PrintWriter out; public static void main(String[] args) throws Exception { scan=new FastScanner(System.in); out=new PrintWriter(System.out); int T=1; // int T=scan.nextInt(); while(T-->0) { ...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 8
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
3a153f6a1df92211f16c9d43c7140cf7
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 the correct formal description of the homework assignment:You are given a string $$$s$$$ of ...
256 megabytes
import java.util.*; import java.util.function.*; import java.io.*; // you can compare with output.txt and expected out public class RoundDeltixAutumn2021B { MyPrintWriter out; MyScanner in; // final static long FIXED_RANDOM; // static { // FIXED_RANDOM = System.currentTimeMillis(); // } final stati...
Java
["9 10\nabcabcabc\n1 a\n1 b\n2 c\n3 a\n4 b\n5 c\n8 a\n9 b\n1 c\n4 a"]
2 seconds
["3\n2\n2\n2\n1\n2\n1\n1\n1\n0"]
NoteLet's consider the state of the string after each query: $$$s =$$$ "abcabcabc". In this case $$$3$$$ replacements can be performed to get, for instance, string $$$s =$$$ "bbcaccabb". This string does not contain "abc" as a substring. $$$s =$$$ "bbcabcabc". In this case $$$2$$$ replacements can be performed to get...
Java 17
standard input
[ "implementation", "strings" ]
db473ad780a93983667d12b1357c6e2f
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$$$...
1,100
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 substring.
standard output
PASSED
6069523695dfeb42dd8ea8b445b91f7d
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 Div21609D { static int[] parent, nodes, edges; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStrea...
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
0a75e8833667ac1ce686afcb66e17016
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.Map; import java.util.TreeMap; public class Main { public static void main(String[] args) { new Main(); } public Main() { FastScanner fs = new FastScanner(); java.io.PrintWriter out = new java.io.PrintWriter(System.out); solve(fs, out); out.flush(); } public void solv...
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
065614ae49715f35c4f12ce3454e7af8
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 static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Double.parseDouble; import static java.lang.Math.PI; import static java.lang.Math.min; import static java.lang.System.arraycopy; import static java.lang.System.exit; import static java.util.Arrays.copyOf; ...
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
4aa1a1aeb607a2a0039f133b6bebaa38
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 static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Double.parseDouble; import static java.lang.Math.PI; import static java.lang.Math.min; import static java.lang.System.arraycopy; import static java.lang.System.exit; import static java.util.Arrays.copyOf; ...
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
253adae0b86d7430c39fa802b5716e98
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.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Deque; import java.uti...
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
a4bf69eed701d8e1907aebce63b142cb
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 ProblemD { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(), d = scanner.nextInt(); int available = 0; List<Integer>[] connections = new List[n]; for (int i=0; i<d; 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
b7fd9a36dea110e0bcde032f8e75ae2a
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.*; /** __ __ ( _) ( _) / / \\ / /\_\_ / / \\ / / | \ \ / / \\ / / |\ \ \ / / , \ , / / /| \ \ / / |\_ /| / / / \ \_\ / / |\/ _ '_| \ / / / ...
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
68738db06fcbea510ebeff8179a7d4a9
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.*; /** __ __ ( _) ( _) / / \\ / /\_\_ / / \\ / / | \ \ / / \\ / / |\ \ \ / / , \ , / / /| \ \ / / |\_ /| / / / \ \_\ / / |\/ _ '_| \ / / / ...
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
cfb150d868b390d1a8804adbc8103e97
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 { class DSU { int[] dsu; public DSU(int n) { dsu = new int[n]; Arrays.fill(dsu, -1); } public int find(int u) { if (dsu[u] < 0) return u; return 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 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
3ba6e434865baa8fbd464b98b2af617a
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
/* Codeforces Problem 1609D */ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.PriorityQueue; import java.util.Set; public class SocialNetwork { public static in...
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
2b9eb72ea79b39286229b99220f57303
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 D1609 { public static int[] size; public static int[] parent; public static TreeSet<Size> sizes; public static int ans = 1; public static void main(String[] args) throws IOException, FileNotFoundException { // Scanner in = new Scanner(new File("test.in...
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
cda388e94f77e24b823c6b0a90fb324a
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.lang.*; public class Main implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private Spa...
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
6b24b2d499cf798d302fb07eb4f803f1
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 : Ryan Ranaut __Hope is a big word, never lose it__ ------------- --------------*/ import java.io.*; import java.util.*; public class Codeforces1 { static PrintWriter ou...
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
3f30da15f63983dc1c4e4feab21aebb3
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.InputStreamReader; import java.util.StringTokenizer; import java.util.*; import java.io.*; public class Main { // Graph // prefix sums //inputs public static void main(String args[])throws Exception{ Input sc=new Input(); precalcul...
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
fe6278f7f17115e8954e4b8220bd104b
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.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.util.stream.IntStream; public class One { public static void print(Object o) { System.out.println(o); } public static void pri...
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
8e8c62fc44b6605fcce775d697ee9edd
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.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; // https://codeforces.com/contest/1609/problem/D // Explicación https://www.geeksforgeeks.org/disjoint-set-data-stru...
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
ca28643655bb2e57ddb1a44a4eb48bdf
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.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; public class D { private static class DSU { int[] p; int[] sz; int n; public DSU(int 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 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
fbd2b977e6b95e957d8acd35353ef083
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) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringTokenizer tokenizer = new StringTokenizer(in...
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
9a6ae5392585195bfb3783f2de7c57b6
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.PrintWriter; import java.util.*; public class Main { public static class union_find { int n; int[] sz; int[] par; union_find(int nval) { n = nval; sz = new int[n + 1]; par = new int[n + 1]; for (int i = 0; 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
e150218de7f2b5fa03f540021acca9fa
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 BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); public static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); public static int mod = (int)1e9+7; static boolean[] isprime...
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
0fb32462d43881c873f39b7286216242
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.Arrays; import java.util.InputMismatchException; import java.util.TreeSet; public class D { static int M = (int) 1e6; public static void main(String[] args) { FastIO io = new FastIO(); int n = io.nextInt(); int d = io.nextInt(); 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 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
c7efdace1cd3f516ad33953886b76212
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.math.*; import java.io.*; import java.util.stream.Collectors; import java.text.DecimalFormat; public class A{ static FastScanner scan=new FastScanner(); public static PrintWriter...
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
12e10070bed8411eb717c3bb24a09f52
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.math.*; import java.io.*; import java.util.stream.Collectors; import java.text.DecimalFormat; public class A{ static FastScanner scan=new FastScanner(); public static PrintWriter...
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
6e7aeeb2477336e84dfd4561a909fb23
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.File; import java.lang.invoke.MethodHandles; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; 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 // D. So...
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
22d6597098cd3bf889e26103d7a0147e
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 { private static int get_parent(int[] dsu, int node) { if (dsu[node] == node) { return node; } dsu[node] = get_parent(dsu, dsu[node]); return dsu[node]; } public static void main(String[] args) throws Exception { BufferedReader 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
b893f1a933857902fbc22d9864c3c2fc
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 { private static int get_parent(int[] dsu, int node) { if (dsu[node] == node) { return node; } dsu[node] = get_parent(dsu, dsu[node]); return dsu[node]; } public static void main(String[] args) throws Exception { BufferedReader 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
fa9141fb74b752b4366dfe07ba94ba8c
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) throws java.lang.Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); 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
8b0837c4a475859cf0d453db06640398
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.HashMap; import java.util.TreeSet; 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;...
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
3708918f4eb7d8e03002c0085f4e4f89
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 Solution { static Scanner sc; public static void main (String[] args) { sc = new Scanner(System.in); solve(); } static boolean ans; public static void solve() { int n = sc.nextInt(); int d = sc.nextInt(); int[]parent = new int[n+1]; int[]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 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
124a426b2986e64509b6b3e9f8350796
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.text.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { FastReader sc = new FastReader(); PrintWriter writer = new PrintWriter(System.out); int t = 1; while(t-->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 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
8fd2002338a8b94fe74272f89cd66708
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
//Utilities import java.io.*; import java.util.*; public class a { static int t; static int n, d; static int x, y; static int[] dsu, rank, sz; static int extra; static HashSet<Integer> group; static int max; public static void main(String[] args) throws IOException { t = 1; while (t-- > 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 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
8be4861a6ecaee4c304254522c8e6474
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.lang.reflect.Array; import java.util.*; public class Main { private static class IO extends PrintWriter { private BufferedReader reader; private StringTokenizer st; public IO() { super(System.out); reader = new BufferedReader...
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
51fcdccb2c826555fb0820ee627cd3d1
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.Iterator; import java.util.StringTokenizer; import java.util.TreeSet; public class Main { public static void main(String[] args) { int n = fs.nextInt(); int d = fs.nextInt(); // union-find, but since some introductions // merge already-joined groups, ...
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
8ce8959a145278a33916f4a8f032f163
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 CodeForces { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public void solve() throws Exception { StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt...
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
377fa560ca35be354a8488a4de4d434a
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.Map.Entry; import java.math.*; import java.sql.Array; public class Simple{ public static class Pair implements Comparable<Pair>{ int x; int y; public Pair(int x,int y){ this.x = x; this.y = y; } ...
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
a286706c0ea109aeaa28e0937be1c80d
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
/* _oo0oo_ o8888888o 88" . "88 (| -_- |) 0\ = /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 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
ef1ca2774905e014c5abd80f2caae985
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.text.DecimalFormat; import java.util.Arrays; import java.util.*; import java.util.Scanner; import java.util.StringTokenizer; public class copy { static int log=18; static int[][] ancestor; static int[] depth; static void sieveOfEratosthenes(int n, Arra...
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
671ae06f7ed390b960a18887c9a6dff5
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.lang.*; import java.io.*; public class Main { class DSU { int[] parent , rank; int n ; int extra; DSU(int n) { this.n = n; parent = new int[n]; for (int i = 0; i < n; i++)parent[i] = 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
1d48e8d99604babfc09031b679355585
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.Scanner; import java.util.Arrays; public class D1609 { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); int n=stdin.nextInt(),d=stdin.nextInt(); int[] components = new int[n]; // Component ID of person i. 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 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
3ff29dbbb71b085b27c003848cba1759
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_1069 { static String in[]; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out)); static int i(String s) { return Integer.parseInt(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
932179ef9a8211485d64f7681d63aa55
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 groupbang {static int extra=1; static TreeMap <Integer,Integer> mp; public static void main(String[] args) { Scanner in=new Scanner(System.in); int n=in.nextInt();int d= in.nextInt(); uf u=new uf(n,d); for(int i=1;i<=d;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
d13c7dadcc9690d0bd339bfcd1e79c69
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.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String[] tokens = scanner.nextLine().split(" "); int num = Integer.parseInt(t...
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
9cddab152c0047177f5e77bb44acc344
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.Closeable; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.*; public class D { public static void main(String[] args) throws IOException { FastScanner scanner = new FastScanner(); int n = scanner.nextInt(); int d = ...
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
7c6be28eedb59d959a0e0121ab53b473
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 int[] components; public static void main(String[] args) throws Exception { FastIO in = new FastIO(); int n = in.nextInt(); int d = in.nextInt(); ArrayList<ArrayList<Integer>> adjacent = new ArrayList<ArrayList<Integer>>(); ...
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
2a5b2b8f9b24dc513ec6e6fa1c9287b4
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.BigInteger; import java.util.*; public class Main { static int MOD = 1000000007; // After writing solution, quick scan for: // array out of bounds // special cases e.g. n=1? // npe, particularly in maps // // Big numbers arithmetic bugs: // in...
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
4c9589433a48d58f6dd33cfe7d0e0c92
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 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
8a63edf8fa2a58c1e28ce39704ca0177
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.awt.Point; public class Main{ static int mod = (int) (Math.pow(10, 9)+7); static final int dx[] = { -1, 0, 1, 0 }, dy[] = { 0, -1, 0, 1 }; static final int[] dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 }; static final int[] d...
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
5d056c4ec9248f60e1ceaa2d5c473ca0
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.File;import java.io.FileInputStream;import java.io.FileNotFoundException; import java.io.IOException;import java.io.InputStream;import java.io.PrintWriter; import java.security.AccessControlException;import java.util.Comparator;import java.util.HashMap; import java.util.List;import java.util.Map;import j...
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
b0773ea3cc98951a8284c9fd717351b1
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 codeforceb { //ArrayList<Integer> arr2=new ArrayList<Integer>(); //ArrayList<Integer> arr1=new ArrayList<Integer>(); //Map<Integer,Integer> hm=new HashMap<Integer,Integer>(); //Set<Integer> st1=new HashSet<Integer>(); static Set<Integer> prime=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
5a75cd05921f34585a407cb2190202d9
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 Main{ static int [] arr; static int tmp; public static int find(int x){ if(arr[x]<0){ return x; }else return find(arr[x]); } public static void union(int x, int y){ int rootX = find(x); int rootY = find(y...
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
19729fd7e3ee90555696e48eb789f63b
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 Main{ static int [] arr; static int tmp; public static int find(int x){ if(arr[x]<0){ return x; }else return find(arr[x]); } public static void union(int x, int y){ int rootX = find(x); int rootY = find(y...
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
db1e138d154ef2f0c7703690f3b55432
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 { void go() { int n = Reader.nextInt(); int d = Reader.nextInt(); int[][] edges = new int[d][2]; DSU dsu = new DSU(n + 1); for(int i = 0; i < d; i++) { edges[i][0] = Reader.nextInt(); e...
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
1ec3b87819bea33ac26b43376d6e0bfe
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.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Objects; import java.util.StringTokenize...
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
ea3d4125a4525f57d282e0d294060fd2
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.concurrent.LinkedBlockingDeque; import javax.security.auth.login.AccountExpiredException; import javax.swing.text.Segment; import java.io.*; import java.math.*; import java.sql.Array; import java.sql.ResultSet; import java.sql.SQLException; public class Main { ...
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
c875a25eb66ae91e6c19d53c4b14f3bf
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.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; import java.util.List; import java.util.StringTokenizer; public 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 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
279d739d8c7cb6bf5b20d02385fd5705
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.*; import static java.lang.Math.ceil; import static java.util.Arrays.sort; public class C { public static void main(String[] args) throws IOException { int n = rni(); int d = ni(); DisjointSetUnion set = new Di...
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
3d94e8b2ec9640137921c11964255b5c
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.PrintStream; import java.io.File; import java.io.FileInputStream; import java.util.*; public class Main { // static final File ip = new File("input.txt"); // static final File op = new File("...
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
e07a1f138b8a385c0d27eac7a24c3a3f
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) { FastScanner fs=new FastScanner(); /****** CODE STARTS HERE *****/ //------------------------------------------------------------------------------------------------------------ int n=fs.nextIn...
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
70efb8ef263d494925d4479f2f1dffda
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.BigInteger; public class Main { private static FS sc = new FS(); private static class FS { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); String next() { w...
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
07e2a29931b8ce71b91d649ccabffe37
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.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; /** * @author Mubtasim Shahriar */ public class DeltixAutumn2021 { public static void main(String[] args) { InputStream 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 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
8cb8f541c68b857a8e69b308ecd125a0
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.InputStreamReader; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; /** * Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10...
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
4c84d75a7e2f107697c5168b9f319737
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.util.Map.Entry.comparingByValue; public class codeforces_deltix_A2021_D { private static void solve(FastIOAdapter in, PrintWriter out) { int n = in.nextInt(); int d = in.nextInt(); DisjointUnionSets set = new DisjointUnion...
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
010526c4b1b9dae81bf436968d232bb4
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.util.Arrays; import java.util.HashSet; import java.util.StringTokenizer; public class D { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(...
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
630b9ec280a847fbcc9e027a7da3b316
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 CodeForces{ /*-------------------------------------------EDITING CODE STARTS HERE-------------------------------------------*/ public static void main(String[] args) throws IOException{ openIO(); int testCase = 1; // testCase = 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 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
6580caeae85d615253c1568cd8284668
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 currentContest; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.Linke...
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
9194b44a1fb27a474d54bc847243ed23
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.PrintWriter; import java.util.Random; import java.util.Scanner; public class Main { public static void main(String[] args) { var sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); int d = Integer.parseInt(sc.next()); var x = 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 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
f83904b3d7e6873fd9313c355962b85c
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.Comparator; import java.util.Scanner; import java.util.TreeSet; public class D { public static void main(String[] args) { Scanner s = new Scanner(System.in); solve(s.nextInt(), s.nextInt(), s); } public static void solve(int n, int c, Scanner 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
541d86b097cf3209fc1f33b7b129d980
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.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.Map; import java.util.StringTokenizer; import java.util.TreeMap; public class ProblemD { static class UnionFind{ 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
5833035d144260f26c43c769e5888077
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 { public static void main(String[] args) { FastScanner sc = new FastScanner(); int n = sc.nextInt(); int d = sc.nextInt(); UnionFind uf = new UnionFind(n); Multiset inside = new Multiset(); inside.add(1); Multiset outside = new Multiset(); 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